Convert numbers between hexadecimal, decimal, binary, and octal
How hex, decimal, binary and octal conversion works, what it changes, signed hex values, a reference table, and checks to run before trusting an online converter.
Is an online hex-to-decimal converter suitable for your use?
For most everyday needs, yes. These needs include reading a color channel, checking a byte value, decoding an error code, or turning a decimal count into hex for a config file. Changing the base of a whole number is exact arithmetic, so a correct converter returns the same value in a different notation. The main benefit is speed and fewer manual slips. The decisive tradeoff is interpretation, not arithmetic. A converter has to assume whether the input is signed or unsigned, what bit width applies, and whether a string like "A" is a digit or a text character. If those assumptions don't match your context, the output can be correct for the tool and still wrong for you.
Plain decimal is the better choice for people. Use decimal for quantities, prices, counts, or anything a non-technical reader must understand or type back in. Keep the hex, binary or octal form when the destination expects it, such as source code, register maps, permissions, or color codes. When in doubt, show both.
What base conversion actually changes
Conversion changes only the written representation of a number, never its value. Decimal uses ten digits (0–9). Binary uses two (0 and 1), octal uses eight (0–7), and hexadecimal uses sixteen (0–9 followed by A–F, where A is 10 and F is 15). Each position is worth the base raised to a power. In hex, the rightmost digit counts ones, the next counts sixteens, the next counts 256s, and so on.
Hex and octal are popular because they map cleanly onto binary. One hex digit is exactly four bits, and one octal digit is exactly three bits. This lets you convert between them by grouping bits, without any division. Decimal has no such alignment, which is why converting to or from decimal takes arithmetic.
Hex to decimal
Multiply each digit by its place value and add the results. Hex 32 is 3×16 + 2 = 50. Hex E3 is 14×16 + 3 = 227.
1F4 (hex)
= 1×256 + 15×16 + 4×1
= 256 + 240 + 4
= 500 (decimal)
Decimal to hex
Divide repeatedly by 16 and keep the remainders. Then read the remainders from last to first. The same method works for binary (divide by 2) and octal (divide by 8).
500 ÷ 16 = 31 remainder 4
31 ÷ 16 = 1 remainder 15 (F)
1 ÷ 16 = 0 remainder 1
Read upward: 1F4
Hex to binary and binary to octal
To convert hex to binary, replace each hex digit with its four-bit pattern. To get octal from that binary, regroup the bits in threes, starting from the right.
Hex: 1 F 4
Binary: 0001 1111 0100
Regroup: 111 110 100
Octal: 7 6 4 → 764
Decimal check: 7×64 + 6×8 + 4 = 500
Decimal to 8-bit binary
An 8-bit result is the binary value padded with leading zeros to eight digits. It only works for 0 to 255 when unsigned. For example, 200 is 11001000, which is C8 in hex and 310 in octal, while 6 written as 8 bits is 00000110. A value above 255 can't fit in 8 bits. A converter that silently truncates it is giving you a different number.
Decimal, binary, octal and hexadecimal table
This chart covers single hex digits, which are enough to convert any hex number to binary by substitution.
| Decimal | Binary (4-bit) | Octal | Hex |
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 3 | 0011 | 3 | 3 |
| 4 | 0100 | 4 | 4 |
| 5 | 0101 | 5 | 5 |
| 6 | 0110 | 6 | 6 |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
Some commonly looked-up values, all computed from the place-value rules above:
| Hex | Decimal | Binary | Octal |
| 6 | 6 | 110 | 6 |
| A | 10 | 1010 | 12 |
| B | 11 | 1011 | 13 |
| D | 13 | 1101 | 15 |
| 13 | 19 | 10011 | 23 |
| 25 | 37 | 100101 | 45 |
| 32 | 50 | 110010 | 62 |
| E3 | 227 | 11100011 | 343 |
| FE | 254 | 11111110 | 376 |
| FF | 255 | 11111111 | 377 |
Watch the short entries. Hex 13 is nineteen, not thirteen. Decimal 13 is D in hex. Many lookup mistakes come from reading a hex string as if it were decimal.
Signed hex to decimal
The same hex digits can stand for two different decimal numbers. Which one you get depends on whether the value is treated as unsigned or as a signed two's-complement integer of a fixed width. Under two's complement, if the highest bit at that width is 1, the value is negative. Its decimal form is the unsigned value minus 2 to the power of the width.
FE as unsigned: 254
FE as signed 8-bit: 254 − 256 = −2
FF as signed 8-bit: 255 − 256 = −1
E3 as signed 8-bit: 227 − 256 = −29
FE as signed 16-bit: 254 (high bit of 0x00FE is 0)
FFFE as signed 16-bit: 65534 − 65536 = −2
Width is the key setting. FE is −2 only if you know it is a single signed byte. If a converter doesn't let you choose the signedness and bit width, assume it is showing the unsigned value. Do the subtraction yourself when you need the signed result.
Ambiguous meanings of "hex" and "reverse"
- Hex number versus hex-encoded text: the digit A means ten, but the text character "A" is stored as byte 41 in ASCII and UTF-8. A "text to hex" tool converts characters to byte codes. A number converter treats the input as a numeric value. Feeding one kind of input into the other kind of tool produces confident nonsense.
- Hex color codes: a code such as FF8000 is three separate two-digit channels (FF, 80, 00 = 255, 128, 0), not one large number. Converting it as a single value gives 16744448, which is rarely what anyone wants.
- Reversing is not byte swapping: reversing the characters of 01F4 gives 4F10, a different number. Changing byte order (endianness) swaps whole two-digit bytes, turning 01F4 into F401. If a workflow says "reverse" or "flip" a hex value, confirm which of these is meant.
- Prefixes and suffixes: 0x, #, a trailing h, and 0b or 0o mark the base. They are not digits. A tool may accept, ignore or reject them, so test with your own format before relying on it.
Will the result stay correct after copying or sharing?
The digits themselves are ordinary ASCII characters, so copying a converted value doesn't involve the rendering and font problems that styled Unicode text has. The risks come from what the destination does with those characters.
- Leading zeros: a spreadsheet or form that treats the value as a number can drop them, so 00000110 becomes 110 and loses its 8-bit width. Store the value as text if the width matters.
- Scientific-notation misreads: a hex string made of digits and the letter E, such as 1E3, can be interpreted by some spreadsheets as 1×10³. Check how your specific spreadsheet handles it, and format the cell as text before pasting.
- Large-value precision: tools that do arithmetic with standard double-precision floating point can't represent every integer above 9,007,199,254,740,991. You can't tell from a tool's appearance which approach it uses. A quick check is to convert hex 20000000000001, which should give 9007199254740993. A result ending in 992 means the tool is rounding.
- Grouping and separators: spaces or underscores between bit groups improve readability, but some parsers reject them. Remove them before pasting into code or a strict input field.
- Case: A–F and a–f mean the same thing in hex. Some systems that compare strings rather than numbers will treat them as different.
For accessibility, long binary or hex strings are hard to read aloud. How a given screen reader announces a value like 0x1F4 or a 32-digit bit string wasn't tested for this article, so no claim is made about specific assistive technology. Where people rather than programs will read the value, give the decimal equivalent alongside it. Group long binary into fours or eights to make it easier to scan. Label the base explicitly instead of relying on a prefix the reader may not recognize.
Before trusting an online converter
- Check a known pair from the table above, such as FF to 255 and E3 to 227, and one larger value you can verify by hand.
- Confirm whether it treats input as signed or unsigned and at what width, using FE as the test.
- Test the precision check above if you work with 64-bit values, hashes or large IDs.
- Paste your real input format, including prefixes, spaces and case, to see how it is parsed.
- Don't assume anything about what happens to the values you enter. This article makes no claim about any tool's data handling, and a tool's design or wording is not evidence of its retention practices. Avoid pasting keys, account numbers or other sensitive values into a tool whose policy you haven't reviewed. These conversions are simple enough to do locally.
Gaps in this review
The arithmetic and table values above follow directly from the definitions of each base and can be checked by hand. No specific converter, spreadsheet or screen reader was tested. Statements about how destinations treat leading zeros, scientific notation or announcements are cautions to verify in your own environment, not observed results.