Hex/Decimal Converter: Convert Between Hexadecimal and Decimal Numbers
Hexadecimal is everywhere in programming — memory addresses, color codes, character encodings, MAC addresses, and error codes. Converting between hex and decimal by hand works for small values but becomes impractical for anything larger than two digits. Our converter handles both directions instantly and shows the binary and octal representations as well.
Number Systems Explained
Decimal (Base 10)
The system you use every day. Ten digits (0-9), and each position represents a power of 10.
255 = 2*100 + 5*10 + 5*1
= 2*10^2 + 5*10^1 + 5*10^0
Hexadecimal (Base 16)
Uses sixteen digits: 0-9 and A-F (where A=10, B=11, C=12, D=13, E=14, F=15). Each position represents a power of 16.
FF = F*16 + F*1
= 15*16 + 15*1
= 240 + 15
= 255
Hex is compact. A single hex digit represents exactly 4 bits, so two hex digits represent one byte (0-255). This direct mapping to binary makes hex the preferred human-readable format for binary data.
Binary (Base 2)
Two digits (0 and 1). Each position represents a power of 2. This is the native language of computers.
11111111 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255
Octal (Base 8)
Eight digits (0-7). Each position represents a power of 8. Less common than hex but still used in Unix file permissions and some legacy systems.
377 = 3*64 + 7*8 + 7*1 = 192 + 56 + 7 = 255
Why Hexadecimal Matters
Compact Binary Representation
One hex digit maps to exactly 4 binary digits (a nibble). This makes hex a natural shorthand for binary data:
Binary: 1010 1111 0011 1100
Hex: A F 3 C
Binary: 11111111
Hex: FF
Decimal: 255
Reading AF3C is far easier than reading 1010111100111100, and the conversion between them is mechanical.
Common Hex Values to Know
| Hex | Decimal | Significance |
|---|---|---|
| 0x00 | 0 | Null byte |
| 0x0A | 10 | Line feed (newline) |
| 0x0D | 13 | Carriage return |
| 0x20 | 32 | Space character |
| 0x41 | 65 | Letter ‘A’ in ASCII |
| 0x7F | 127 | Max signed 8-bit value |
| 0xFF | 255 | Max unsigned 8-bit value |
| 0xFFFF | 65535 | Max unsigned 16-bit value |
| 0xFFFFFFFF | 4294967295 | Max unsigned 32-bit value |
Where You Encounter Hex
CSS and Web Colors
Web colors are hex-encoded RGB values. Each pair of hex digits represents one color channel:
#FF5733
││││││
RR GG BB
255 87 51
Memory Addresses and Debugging
Debuggers, crash logs, and stack traces show memory addresses in hex:
Segfault at 0x7FFE4A3B2C10
Stack pointer: 0x00007FFE4A3B2BF0
MAC Addresses and Network Data
Network hardware identifiers use hex with colon or dash separators:
00:1A:2B:3C:4D:5E
Character Encoding
Unicode code points are expressed in hex. The emoji for a thumbs up is U+1F44D (decimal 128077). URL-encoded characters use percent-hex notation: %20 for space (hex 20 = decimal 32).
File Formats and Hex Editors
File signatures (magic numbers) that identify file types are hex values:
PDF: 25 50 44 46 (%PDF)
PNG: 89 50 4E 47 (.PNG)
ZIP: 50 4B 03 04 (PK..)
Unix File Permissions
While permissions are technically octal, they often appear alongside hex in system programming. The chmod value 755 is octal, and understanding base conversions helps when working across these contexts.
How to Convert Manually
Hex to Decimal
Multiply each digit by its positional power of 16 and sum:
1A3 (hex) to decimal:
1 * 16^2 = 1 * 256 = 256
A * 16^1 = 10 * 16 = 160
3 * 16^0 = 3 * 1 = 3
Total = 256 + 160 + 3 = 419
Decimal to Hex
Repeatedly divide by 16 and collect the remainders:
419 (decimal) to hex:
419 / 16 = 26 remainder 3 -> 3
26 / 16 = 1 remainder 10 -> A
1 / 16 = 0 remainder 1 -> 1
Read remainders bottom to top: 1A3
For anything beyond two or three digits, this process is slow enough that a converter tool saves real time.
How to Use Our Hex/Decimal Converter
- Enter a number in either hexadecimal or decimal format
- View the conversion along with binary and octal equivalents
- Toggle direction to convert in whichever direction you need
- Copy any output with one click
Tips
- Hex input accepts both uppercase and lowercase letters (ff, FF, and Ff all work)
- Prefix hex values with
0xor enter the digits directly — the tool handles both - Use the binary output for bit-level analysis and the octal output for Unix permissions
- All conversions happen locally in your browser — nothing is sent to a server
Quick Conversion Table
| Decimal | Hex | Binary | Octal |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 10 | A | 1010 | 12 |
| 16 | 10 | 10000 | 20 |
| 100 | 64 | 1100100 | 144 |
| 255 | FF | 11111111 | 377 |
| 256 | 100 | 100000000 | 400 |
| 1024 | 400 | 10000000000 | 2000 |
| 65535 | FFFF | 1111111111111111 | 177777 |
Frequently Asked Questions
Why do programmers use hexadecimal instead of decimal? Because hex maps cleanly to binary. One hex digit equals exactly 4 bits, so a byte (8 bits) is always two hex digits. This makes it far easier to read and reason about binary data compared to decimal, where the relationship to bits is not as direct.
What does the 0x prefix mean?
The 0x prefix is a convention in programming languages (C, JavaScript, Python, Java, and others) to indicate that the following digits are hexadecimal. Without the prefix, 10 could mean decimal ten or hex sixteen.
How do I convert hex to binary quickly? Replace each hex digit with its 4-bit binary equivalent: 0=0000, 1=0001, …, 9=1001, A=1010, B=1011, C=1100, D=1101, E=1110, F=1111. Concatenate them and you have the full binary value.
Can hexadecimal represent negative numbers?
Not directly, but signed integer representation uses two’s complement in binary, which is then displayed as hex. For example, -1 as a 32-bit signed integer is 0xFFFFFFFF.
What is the largest hex number this tool supports? The tool handles numbers within the safe integer range of JavaScript (up to 2^53 - 1, or 9007199254740991 in decimal, which is 0x1FFFFFFFFFFFFF in hex). This is more than sufficient for virtually all practical conversion needs.
Try our free Hex/Decimal Converter to convert between hexadecimal and decimal with binary and octal output instantly.
Try Ghost Image Hub
The Chrome extension that makes managing your Ghost blog images a breeze.
Learn More