Hexadecimal to Decimal
Convert a hexadecimal number to decimal.
Formula
Variables
Example
0x1F = 31
How it works
A hexadecimal number is a base-16 number system, so each digit represents a value times a power of 16, just as each digit in decimal represents a value times a power of 10. This formula adds up every digit’s contribution from right to left: the rightmost digit is multiplied by 16^0, the next by 16^1, and so on. It works because positional numeral systems encode numbers by place value rather than by separate symbols alone.
When to use it
Use this when you need to read, check, or convert hexadecimal values into ordinary decimal numbers. It is common in programming, debugging memory addresses, color codes, and low-level data representation.
Worked example, step by step
Convert 0x2A3 to decimal N = 2×16^2 + A×16^1 + 3×16^0 A = 10, so N = 2×256 + 10×16 + 3×1 N = 512 + 160 + 3 N = 675
Common mistakes to avoid
- Forgetting that A through F stand for 10 through 15
- Using powers of 10 instead of powers of 16
- Starting the place values from the left instead of the right
Did You Know?
Programmers love hexadecimal because each digit maps neatly to exactly four binary bits.
Share this formula
More in Computer Science
View allShannon Entropy
AdvancedAverage information content of a random source (bits).
Master Theorem (form)
AdvancedAnalyzes running time of divide-and-conquer algorithms.
Hamming Distance
AdvancedNumber of positions at which two strings differ.
Bits to Represent n
BasicMinimum number of bits to represent n distinct values.
Binary to Decimal
BasicConverts a binary number to decimal.
Nodes in a Full Binary Tree
IntermediateTotal nodes in a perfect binary tree of height h.