Number Base Converter
Convert between binary, octal, decimal and hexadecimal.
Number
Result
About the Number Base Converter
The Number Base Converter reads a value in one base and writes it in the others: binary, octal, decimal and hexadecimal. Type a number, say which base it is in, and the page shows the same quantity in every base at once.
A base is how many distinct digits a system uses before it carries. Binary has two, so every column doubles; octal has eight; decimal has ten; hexadecimal has sixteen, which is why it needs the letters A to F for the values ten to fifteen. The number of a value does not change, only the way it is written.
Hexadecimal survives because four binary digits map exactly onto one hex digit, so a long binary string becomes short and readable. That is why memory addresses, colour codes and hash values are written in hex. Watch for prefixes when reading code: 0x means hex, 0b means binary and a leading 0 often means octal.
Common questions about Number Base Converter
What do the bases mean?
The number of digits available before the value carries to the next column. Binary uses 0 and 1, decimal 0 to 9, hexadecimal 0 to 9 plus A to F.
Why does hexadecimal use letters?
Sixteen digits are needed but only ten numeral symbols exist, so A to F stand for ten to fifteen.
How do I read a binary number?
Each digit is a power of two from the right. 1010 is 8 + 2, so ten.
Can I enter negative numbers?
The converter works on unsigned values. For negative numbers you need two's complement, which is a different representation.
What is the largest value I can convert?
Large integers are handled up to the precision JavaScript numbers allow, which is safe for everyday programming values but not for arbitrary-length integers.
Why do programmers use hex?
Four bits map to one hex digit, so binary values stay short and readable, and byte boundaries line up neatly.