Number Base Converter
Convert numbers between binary, octal, decimal, hexadecimal, and custom bases (2-36).
About This Tool
Convert numbers between binary, octal, decimal and hexadecimal, or from any custom base from 2 to 36, with a step-by-step breakdown of the math.
One number, four ways of writing it
The value forty-two can be written as 42 in decimal, 101010 in binary, 52 in octal and 2a in hexadecimal. They are the same quantity expressed with different numbers of digit symbols. This converter shows all four at once as you type, which is useful for programmers reading memory addresses or bit flags, students learning how positional number systems work, and anyone decoding values from network tools, file permissions or color codes.
How to use the converter
- Pick the base of the number you already have under Input Base: Binary, Octal, Decimal or Hexadecimal. Choose Custom to enter any base between 2 and 36. Changing the base clears the input.
- Type the number into Input Number. Characters that are not valid for the chosen base are rejected, and the field is outlined in red if something invalid gets in.
- Read the results in the four output cards. Each card has a copy button.
- You can also type directly into any output card; the input is recalculated from it.
- Open Conversion Breakdown to see the positional expansion and the decimal value used along the way.
How positional number systems work
In any base b, each digit is multiplied by a power of b that depends on its position, counting from zero on the right. Decimal 352 means 3×10² + 5×10¹ + 2×10⁰. Binary 1101 means 1×2³ + 1×2² + 0×2¹ + 1×2⁰, which is 8 + 4 + 0 + 1 = 13. The breakdown panel shows exactly this expansion for your input.
To go from decimal to another base, you repeatedly divide by the target base and collect the remainders, reading them from last to first. Bases above 10 need extra digit symbols, so letters are used: a is 10, b is 11, and so on up to z for 35. That is why 36 is the highest base supported.
Hexadecimal and octal are popular in computing because they map cleanly onto binary. One hex digit is exactly four bits, so the byte 11111111 is ff. One octal digit is three bits, which is why Unix file permissions like 755 are written in octal; the chmod calculator builds on that idea.
Useful details
- Large integers stay exact. The integer part is converted with arbitrary-precision arithmetic, so long values such as 64-bit IDs do not lose digits.
- Fractions are supported with a decimal point, for example
0.1or101.011. Many fractions repeat forever in another base, so the fractional part is cut off after 20 digits. Decimal 0.1 in binary is a classic repeating example. - Negative numbers are shown with a leading minus sign. The tool does not produce two's complement representations, which depend on a fixed bit width.
- Hex input can be upper or lower case; output is written in lower case.
Common mistakes
- Do not include prefixes such as
0x,0bor0o. Type only the digits and select the base. - Remember that leading zeros carry no value.
0010in binary is just 2. - For colors written as hex, the color converter is more convenient, since it splits the value into red, green and blue channels.
FAQ
Why does a simple decimal fraction turn into a long binary string?
Only fractions whose denominator is a power of the target base terminate. One tenth is not a sum of powers of one half, so in binary it repeats indefinitely.
What is base 36 used for?
It uses all ten digits and all 26 letters, which makes it a compact way to write large numbers as short identifiers, such as in some URL shorteners.
Can I convert directly between two custom bases?
You can enter a number in any custom base, but the outputs are always binary, octal, decimal and hexadecimal.