Converters
Number Base Converter
Binary, octal, decimal, hex.
About the Number Base Converter
The Number Base Converter shows any whole number in decimal, binary, octal and hexadecimal at once, plus any other base from 2 to 36. Choose the base you typed in, or use Auto to read 0x, 0b and 0o prefixes. It handles numbers of any size exactly, shows the bits and byte count, and copies any result with a tap.
What you can do with the Number Base Converter
- Four bases at once: Decimal, binary, octal and hexadecimal side by side as you type.
- Any base 2–36: Convert to unusual bases too, not just the common four.
- Auto-detect: Reads 0x, 0b and 0o prefixes automatically.
- Any size, exact: Handles very large numbers exactly and shows the bit and byte count.
How number bases work
In decimal, each position is worth ten times the one to its right. In binary, each position is worth twice as much, so only 0 and 1 are used. Hexadecimal needs sixteen digits, so after 9 it uses A to F for 10 to 15. Bases up to 36 use all the letters of the alphabet.
Where you'll meet them
Hexadecimal maps neatly onto binary, one hex digit is exactly four bits, so it's used for colour codes like #FF8800 and memory addresses. Octal appears in Unix file permissions, such as chmod 755. Base 36 is used for short IDs and URL shorteners because it packs a lot into few characters.
Any size, exactly
Ordinary calculators lose precision above 9,007,199,254,740,991. This tool uses big-integer arithmetic, so even 30-digit numbers convert exactly. Negative numbers keep their minus sign.
Related tools
Frequently Asked Questions
What is 255 in hexadecimal and binary?
FF in hexadecimal and 11111111 in binary, the largest value a single byte can hold.
What do 0x, 0b and 0o mean?
They're prefixes programmers use for hex, binary and octal. Choose Auto and the tool reads them for you.
How do I convert text to binary instead of a number?
Use the Binary Translator, which converts each character of your text.
How do I convert decimal to binary by hand?
Divide the number by 2 repeatedly and write down each remainder, then read the remainders from bottom to top. For 13: 13/2 = 6 r1, 6/2 = 3 r0, 3/2 = 1 r1, 1/2 = 0 r1, so 13 is 1101 in binary.
How do I convert hex to decimal by hand?
Multiply each digit by a power of 16, counting from the right, and add them up, with A to F meaning 10 to 15. For 1A3: 1 x 256 + 10 x 16 + 3 x 1 = 419.
Why does hexadecimal use letters?
Base 16 needs sixteen digits, so after 0 to 9 it uses A to F for 10 to 15. Higher bases continue the alphabet: base 36 uses 0 to 9 and A to Z, which is why it is popular for short codes and IDs.
Can it convert negative numbers?
Yes, type a minus sign and the result keeps the minus sign in every base, such as -255 to -FF. It does not show the two's complement form that computers use internally, and the bits panel shows the number without its sign.
Can I convert decimal fractions like 12.5?
No, it converts whole numbers only. A decimal point is not a valid digit, so 12.5 shows an error. To convert a fraction you would need to handle the part after the point separately, by repeatedly multiplying it by the target base.
Why do I get an error saying a digit isn't valid?
The number contains a digit that does not exist in the chosen base, such as a 2 in binary, an 8 in octal or a G in hex. Check that the It is written in option matches your number, or choose Auto if it has a 0x, 0b or 0o prefix.
Can I paste numbers with spaces, commas or underscores?
Yes. Spaces, commas and underscores are ignored, so 1111 1111, 1111_1111 and 1,000,000 are all read correctly. This makes it easy to paste grouped binary or numbers copied from code.
How many bytes does a number need?
Count its binary digits and divide by 8, rounding up. 255 is 11111111, which is 8 bits or 1 byte, while 256 needs 9 bits and so 2 bytes. The bits panel shows the bit count, byte count and how many bits are set.
Related tools
- Time Converter, Convert durations from seconds to years.
- Data Storage Converter, Convert bits, bytes, KB, MB, GB and TB.
- Pressure Converter, Convert between pascal, bar, psi and atm.
- Energy Converter, Convert joules, calories, kWh and BTU.
- Power Converter, Convert watts, kilowatts and horsepower.
- Angle Converter, Convert degrees, radians and gradians.