Number Base Converter
Convert whole numbers between binary, octal, decimal, hexadecimal and any base from 2 to 36, with the place-value expansion.
- Binary (base 2)
- 1111 1111
- Octal (base 8)
- 377
- Decimal (base 10)
- 255
- Hexadecimal (base 16)
- FF
- Base 36
- 73
About this tool
A number base is the number of digits a positional system uses. In base 10, the one we use every day, each place is worth ten times the place to its right: 2026 = 2 × 10³ + 0 × 10² + 2 × 10 + 6. In base 2, or binary, there are only the digits 0 and 1, and each place is a power of 2: 1010₂ = 1 × 2³ + 0 × 2² + 1 × 2 + 0 = 10.
Computers work in binary, and programmers use hexadecimal (base 16, digits 0–9 then A–F) as a compact shorthand: one hex digit stands for exactly 4 bits, so a byte of 8 bits fits in 2 hex digits. 255 is 11111111 in binary, 377 in octal and FF in hexadecimal. Web colors use it too: #FF8000 means red 255, green 128, blue 0. Bases above 16 continue with letters up to Z, so base 36 uses all 26 letters: 255 = 73₃₆.
To convert a decimal number to another base by hand, divide it repeatedly by the base and read the remainders from bottom to top: 13 ÷ 2 = 6 r 1, 6 ÷ 2 = 3 r 0, 3 ÷ 2 = 1 r 1, 1 ÷ 2 = 0 r 1, so 13 = 1101₂. The converter uses arbitrary-precision integers, so even very long numbers convert exactly, and you can paste values prefixed with 0x or 0b.
Worked example
- 1Type the number, using the digits 0–9 and the letters A–Z allowed in its base.
- 2Choose the base of the number you entered and, if you like, another base to convert to.
- 3Read the binary, octal, decimal and hexadecimal values, and the place-value expansion. Example: 7EA₁₆ = 7 × 16² + 14 × 16 + 10 = 2026.
Formula
N = dₖ × bᵏ + … + d₁ × b + d₀ ; 1 hex digit = 4 bits ; 1 octal digit = 3 bits
Related tools
Frequently asked questions
- How do I convert binary to decimal?
- Multiply each digit by the power of 2 for its place, starting from 2⁰ on the right, and add up the results: 101010₂ = 32 + 8 + 2 = 42.
- Why do programmers use hexadecimal?
- Because it's much shorter than binary and converts to it directly: each hex digit corresponds to a group of 4 bits (A = 1010, F = 1111). The 32-bit value 11111111 00000000 11111111 00000000 is simply FF00FF00 in hex.
- What do the letters A to F mean in hexadecimal?
- They're the digits after 9: A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15. In base 36, the letters continue up to Z = 35.
- Can I convert negative numbers?
- Yes, the sign is kept: −10 in decimal is −1010 in binary. The converter doesn't apply two's complement, the format processors use to store negative integers in a fixed number of bits.