Hex Converter
Convert numbers between hexadecimal, decimal, binary, and octal
Decimal
Hexadecimal
Binary
Octal
Quick Reference
About this tool
Hexadecimal exists because binary is unreadable and decimal does not line up with bytes. One hex digit represents exactly four bits, so two hex digits are exactly one byte - which is why colours are written #FF6600, memory addresses are hex, and byte dumps are hex. Reading 11111111 as 255 requires effort; reading FF as 255 becomes automatic quickly. The conversions themselves are mechanical, but two things trip people up. Hex uses A-F for the values 10-15, so a "number" containing letters is still a number. And the same digits mean different values in different bases - 10 is ten in decimal, sixteen in hex and two in binary - which is why prefixes exist: 0x for hex, 0b for binary. Getting the base wrong is not an error the computer catches, it just produces a plausible wrong answer. Conversion runs in your browser.
How to use this tool
- Enter a valueIn whichever base you have it - hex, decimal or binary.
- Read the equivalentsAll three representations of the same number are shown together.
- Check you used the right base10 means a different value in each system, so confirm the input was interpreted as you intended.
- Copy the form you needHex for colours and addresses, binary for bitwise work, decimal for arithmetic.
How to convert hex to decimal and binary
Each hex digit is worth 16 times the digit to its right. 2F is 2 x 16 + 15 = 47. Each hex digit is also exactly four binary bits, so 2F is 0010 1111 - convert digit by digit. Going the other way, divide a decimal number by 16 repeatedly and read the remainders from last to first.
In code, 0x marks a hex number (0x2F) and 0b a binary one (0b101111). The letters A to F stand for 10 to 15.
Key features
- All three bases at once, so no second conversion step is needed.
- Handles the A-F digits that make hex confusing at first.
- Runs in your browser with no account.
- Useful for colour work, bitwise operations and reading memory dumps alike.
- Instant results as you type.
Common uses
- Converting a colour value between hex and RGB decimal components.
- Reading a memory address or byte offset from a debugger.
- Working out bit flags and masks for bitwise operations.
- Interpreting a hex dump of a file header.
- Learning how number bases relate while studying computing.
Tips for better results
- Remember two hex digits are exactly one byte. That single fact makes hex dumps far easier to read.
- Use the 0x and 0b prefixes in code and notes. They remove all ambiguity about which base a value is in.
- For colours, each pair of hex digits is one channel: #FF6600 is red 255, green 102, blue 0.
- When working with bit flags, binary makes the pattern visible in a way hex and decimal do not.
- For colour conversion specifically, the HEX to RGB tool also gives HSL and CMYK.
Mistakes to avoid
- Reading a hex value as decimal. 20 in hex is 32, not 20, and nothing warns you.
- Forgetting hex digits go up to F, so treating a value containing letters as invalid.
- Dropping leading zeros in a byte value - 0F and F are the same number but not the same byte representation in a dump.
- Mixing up bit and byte counts, since one hex digit is four bits rather than eight.
- Assuming very large values convert exactly - beyond standard integer precision a specialised big-number tool is needed.
Frequently asked questions
Enter your value in whichever base you have and all three representations appear together. Everything is calculated in your browser.
Because one hex digit maps to exactly four bits, so two digits are one byte. That makes hex a compact, readable stand-in for binary - which is why colours, memory addresses and byte dumps all use it.
They are the digits for values 10 to 15. Base 16 needs sixteen single-character digits, and decimal only supplies ten, so A-F fill the gap. F is 15, and FF is 255.
Prefixes marking the base - 0x for hexadecimal, 0b for binary. They exist because a value like 10 is ambiguous on its own: ten in decimal, sixteen in hex, two in binary.
Each pair of digits is one colour channel from 00 to FF, in red-green-blue order. #FF6600 is red 255, green 102, blue 0 - which is why the HEX to RGB converter is really just this conversion applied three times.
Negative values depend on representation - computers typically use two's complement, where the same bit pattern means different things depending on whether the value is treated as signed. For signed-integer work, check how your specific language or platform interprets it.
Split the six digits into pairs and convert each: #FF6600 is FF = 255 red, 66 = 102 green, 00 = 0 blue, so rgb(255, 102, 0). A three-digit code like #F60 doubles each digit first.
255 in decimal, FF in hex and 11111111 in binary. Two bytes hold up to 65,535 (FFFF), which is why port numbers and many file-format fields stop there.
Most processors store multi-byte numbers little-endian, least significant byte first, so 0x12345678 appears in memory as 78 56 34 12. Network protocols usually use big-endian order instead.