What is a Hex to Decimal Converter?
A hex to decimal converter turns a number written in base 16 (hexadecimal) into the everyday base 10 (decimal) system. Hexadecimal uses sixteen symbols — 0-9 followed by A, B, C, D, E and F — where A equals 10, B equals 11, and so on up to F equals 15. Programmers, web designers, and electronics engineers use hex constantly for memory addresses, color codes, and byte values, so quickly reading them as decimals is a common need.
How to use it
Type a hexadecimal value into the box — for example 1A3F, FF, or 0x2B (a leading 0x is accepted and ignored). The tool is case-insensitive, so ff and FF give the same answer. Press calculate and the decimal equivalent appears instantly, along with a check confirming the input was valid hex.
The formula explained
Each digit contributes its face value multiplied by a power of 16 determined by its position, counting from 0 at the rightmost digit:
$$\text{Decimal} = \sum_{i=0}^{n-1} d_i \times 16^{\,i}, \qquad d_i \in \text{Hexadecimal value}$$
Working example for 1A3F: F=15 at position 0 gives \(15 \times 1 = 15\); 3 at position 1 gives \(3 \times 16 = 48\); A=10 at position 2 gives \(10 \times 256 = 2560\); 1 at position 3 gives \(1 \times 4096 = 4096\). Summing: $$15 + 48 + 2560 + 4096 = \mathbf{6719}.$$
Hex Digit and Power of 16 Reference
Hexadecimal (base 16) uses sixteen symbols: 0–9 and A–F. Each hex digit corresponds to exactly four binary bits.
| Hex digit | Decimal value | 4-bit binary |
|---|---|---|
| 0 | 0 | 0000 |
| 1 | 1 | 0001 |
| 2 | 2 | 0010 |
| 3 | 3 | 0011 |
| 4 | 4 | 0100 |
| 5 | 5 | 0101 |
| 6 | 6 | 0110 |
| 7 | 7 | 0111 |
| 8 | 8 | 1000 |
| 9 | 9 | 1001 |
| A | 10 | 1010 |
| B | 11 | 1011 |
| C | 12 | 1100 |
| D | 13 | 1101 |
| E | 14 | 1110 |
| F | 15 | 1111 |
The position of each digit (counting from the right, starting at 0) determines which power of 16 it is multiplied by:
| Position \(i\) | Power \(16^i\) | Value |
|---|---|---|
| 0 | \(16^0\) | 1 |
| 1 | \(16^1\) | 16 |
| 2 | \(16^2\) | 256 |
| 3 | \(16^3\) | 4,096 |
| 4 | \(16^4\) | 65,536 |
| 5 | \(16^5\) | 1,048,576 |
| 6 | \(16^6\) | 16,777,216 |
| 7 | \(16^7\) | 268,435,456 |
Common Hex Values and Their Decimal Equivalents
| Hex | Decimal | Typical usage |
|---|---|---|
| 0x0A | 10 | Smallest two-digit value using a letter digit; the ASCII line-feed code |
| 0x10 | 16 | First value that needs two hex digits (one sixteen) |
| 0x20 | 32 | ASCII space character |
| 0x41 | 65 | ASCII uppercase letter 'A' |
| 0x7F | 127 | Highest 7-bit ASCII code (DEL); maximum signed 8-bit value |
| 0x80 | 128 | First value with the high bit set in a byte |
| 0xFF | 255 | Maximum unsigned byte; maximum value of an RGB colour channel |
| 0x100 | 256 | Number of distinct values in one byte (\(16^2\)) |
| 0x3FF | 1,023 | Maximum 10-bit value (for example, a 10-bit ADC reading) |
| 0xFFFF | 65,535 | Maximum unsigned 16-bit value; highest TCP/UDP port number |
| 0x7FFFFFFF | 2,147,483,647 | Maximum signed 32-bit integer |
| 0xFFFFFFFF | 4,294,967,295 | Maximum unsigned 32-bit integer |
Interpreting the Decimal Result
Digit count, bits and bytes
Because each hex digit equals 4 bits, the number of digits tells you the storage width:
- 2 hex digits = 8 bits = 1 byte, range 0 to 255
- 4 hex digits = 16 bits = 2 bytes, range 0 to 65,535
- 8 hex digits = 32 bits = 4 bytes, range 0 to 4,294,967,295
In general, \(n\) hex digits give a maximum unsigned value of \(16^n - 1\).
Hex colours as RGB channels
A web colour such as #FF8000 is three bytes: red, green and blue. Split it into pairs and convert each one:
- FF = \(15 \times 16 + 15\) = 255 (red)
- 80 = \(8 \times 16 + 0\) = 128 (green)
- 00 = \(0 \times 16 + 0\) = 0 (blue)
So #FF8000 is rgb(255, 128, 0), an orange. Converting the whole six-digit string at once gives a single number: \(255 \times 65536 + 128 \times 256 + 0 = \) 16744448.
Unsigned input versus two's complement
This converter treats the input as an unsigned number. In signed two's complement notation, a value whose highest bit is set represents a negative number. For an \(n\)-bit value, the signed result is the unsigned result minus \(2^n\). For example, 0xFF is 255 unsigned but -1 as a signed 8-bit value (\(255 - 256\)), and 0xFFFFFFFF is 4,294,967,295 unsigned but -1 as a signed 32-bit value. Check the data type used by your system before deciding which interpretation applies.
FAQ
Does case matter? No. The converter accepts both uppercase and lowercase letters A-F.
Can I include the 0x prefix? Yes. A leading 0x or 0X is automatically stripped before conversion.
What happens with invalid characters? If the input contains anything other than 0-9 and A-F (after an optional 0x), the result is flagged as invalid and shown as 0.