Decimal to Hex Converter — Dec, Hex, Bin
Numbers look different depending on the base you write them in, but the value underneath never changes. This free converter translates a number between decimal, hexadecimal, binary and octal instantly, in any direction. Type a value into any one of the four boxes and the other three update at once. Everything runs in your browser, with no sign-up and no upload, and it handles whole numbers from zero up to 9007199254740991.
Most people count in decimal, base 10, but computers count in binary, base 2, because a wire is either on or off. Hexadecimal, base 16, is the bridge between the two: one hex digit stands for exactly four binary digits, so a long binary string becomes a short, readable hex value. That is why hex appears in web colours such as FF0000 for red, in error codes, memory addresses and file hashes. Octal, base 8, still appears in Unix file permissions.
Converted Values
Type a number in any box above and the other three update instantly.
What Are Decimal, Hex, Binary and Octal?
Every number system is defined by its base, which is how many digits it uses before carrying over to the next place. Decimal, base 10, uses the digits 0 to 9, so 255 means two hundreds, five tens and five ones. Binary, base 2, uses only 0 and 1, so each place doubles, and 11111111 adds up to 255. Octal, base 8, uses the digits 0 to 7, and 377 in octal is also 255. Hexadecimal, base 16, uses 0 to 9 plus the letters A to F for the values 10 to 15, and FF is 255 once again. Four writings, one value, and that is the whole idea behind this converter.
Why Programmers Use Hexadecimal
Hexadecimal is popular because it is compact and lines up neatly with binary. Four binary digits make exactly one hex digit, so eight bits, one byte, are always two hex digits. That makes a byte easy to read at a glance: FF is all eight bits on, 00 is all eight bits off, and 80 is only the highest bit on. Web colours use the same idea, with six hex digits for red, green and blue, so FF0000 is full red and 0000FF is full blue. Memory addresses and download checksums are usually shown in hex too, and octal survives mainly in file permissions such as 755.
How to Use
- Type a number into any one of the four boxes: Decimal for an everyday number, Hexadecimal for a colour or address, Binary for bit patterns, or Octal for a permission value.
- Watch the other three boxes update instantly. There is no button to press; every keystroke converts the value.
- Check the result panel below the boxes. It repeats all four values in a clear list, so you can copy the one you need.
- Fix any error message before copying a value. If a box contains a digit its base does not allow, the tool shows an invalid input message and leaves the other boxes unchanged.
Worked Example
Start with the classic example: 255 decimal = FF hex = 11111111 binary = 377 octal. Type 255 into the Decimal box and the converter fills in FF in Hexadecimal, 11111111 in Binary and 377 in Octal. That is because 255 is the largest value one byte can hold, so all eight binary digits are 1. Two more checks confirm the pattern: 16 decimal = 10 hex = 10000 binary = 20 octal, because 16 is one complete group of sixteen, and 10 decimal = A hex = 1010 binary = 12 octal, because ten needs the letter A in hex. Try typing 0xFF into the Hexadecimal box as well: the optional 0x prefix is stripped and the same four values appear.
Tips for Accurate Conversions
Always check which base your source is using before you type it in, because the same digits mean different values in different bases: 10 in decimal is ten, but 10 in hex is sixteen and 10 in binary is two. When you copy a hex value from code, keep or drop the 0x prefix as you like, since this tool accepts both. Remember that letters in hex are not case-sensitive, so ff, FF and Ff are identical. For large values, stay at or below 9007199254740991, the safe limit. Finally, read colour hex in pairs: red, green, then blue.
Frequently Asked Questions
What is the largest number this converter accepts?
The largest decimal is 9007199254740991, which is 2 to the power of 53 minus 1. That is the largest whole number JavaScript can represent exactly, so anything larger could be rounded and give a wrong conversion.
Why does hexadecimal use the letters A to F?
Hexadecimal is base 16, so it needs sixteen digits. The digits 0 to 9 give only ten, so the letters A to F stand for the values 10 to 15: A means 10, B means 11, C means 12, D means 13, E means 14 and F means 15.
Can I type a hex value with a 0x prefix?
Yes. You can type 0xFF or FF and both mean 255 in decimal. The converter strips the optional 0x or 0X prefix first, and it accepts upper-case and lower-case letters.
What is the difference between decimal, hex, binary and octal?
They are four ways of writing the same number, using different bases. Decimal is base 10 with digits 0 to 9, hexadecimal is base 16, binary is base 2 with only 0 and 1, and octal is base 8 with digits 0 to 7. The value never changes; only the writing changes.
Is my data private when I use this converter?
Yes. This tool runs entirely in your browser. The numbers you type are never uploaded to a server, stored or shared. Closing the page removes them completely.