Number base converter
Binary, octal, decimal, hex and any base to 36, with the working shown.
Private: your files never leave this deviceNothing is uploaded or stored on a serverWorks right here in your browserBits and two's complement
- Signed value
- 2026
- Unsigned value
- 2026
- Hex, 16 bit
- 0x07EA
- Signed range
- -32768 to 32767
Step by step: decimal to binary
Divide the number by 2, write the remainder, and divide the answer again until it reaches 0. Then read the remainders from the bottom up.
| Divide | Answer | Remainder |
|---|---|---|
| 2026 ÷ 2 | 1013 | 0 |
| 1013 ÷ 2 | 506 | 1 |
| 506 ÷ 2 | 253 | 0 |
| 253 ÷ 2 | 126 | 1 |
| 126 ÷ 2 | 63 | 0 |
| 63 ÷ 2 | 31 | 1 |
| 31 ÷ 2 | 15 | 1 |
| 15 ÷ 2 | 7 | 1 |
| 7 ÷ 2 | 3 | 1 |
| 3 ÷ 2 | 1 | 1 |
| 1 ÷ 2 | 0 | 1 |
Remainders from the bottom up: 11111101010
How it is calculated
Each digit is worth the base raised to its place, counting from 0 at the right. Reading a number means adding those up; writing it in another base means dividing by the new base again and again and keeping the remainders.
1011₂ = 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8 + 0 + 2 + 1 = 11₁₀
Fractions work the other way round: multiply the part after the point by the new base, and the whole part of each answer is the next digit. Negative numbers in a fixed number of bits use two's complement: flip every bit and add 1.
-5 in 8 bits: 00000101 → flip 11111010 → add 1 → 11111011
How to convert between number bases
Type in any box
Type a number in the binary, octal, decimal, hexadecimal or custom base box. The others update at once.
Look at the bits
Pick 8, 16, 32 or 64 bits to see the two's complement pattern, and click bits in the grid to switch them on or off.
Learn the method
The step by step table shows the repeated division that turns your decimal number into binary, octal or hexadecimal.
Good to know
- Prefixes 0x, 0o and 0b are understood in the matching box, and spaces or underscores between digits are ignored.
- Digits allowed: binary 0 and 1, octal 0 to 7, hexadecimal 0 to 9 and A to F.
- Hex is binary in groups of four bits, and octal is binary in groups of three. Turn on Group digits to see it.
- Turn off the signed reading to see 11111111 as 255 instead of -1.
- Ctrl+C with nothing selected copies every base at once.
Questions people ask
How do I convert decimal to binary by hand?
Divide the number by 2 and write down the remainder. Divide the answer by 2 again, and keep going until you reach 0. Read the remainders from the last one to the first. The step by step table on this page shows every division for your number.
What is two's complement?
It is how computers store negative whole numbers. In 8 bits, -1 is 11111111 and -128 is 10000000. To make a negative number, flip every bit of the positive number and add 1. The first bit tells you the sign.
Can it convert very large numbers?
Yes. Whole numbers are worked out exactly with big-number maths, so a 100-digit number converts without rounding. Input is limited to a few thousand characters so the page stays quick.
Why does 0.1 in decimal never end in binary?
Some fractions repeat forever in another base, like 1/3 = 0.333... in decimal. 0.1 in decimal is one of them in binary, so the answer is cut after 24 places and marked as cut off.
What do the letters in hexadecimal mean?
Bases above 10 need more digits than 0 to 9, so letters are used: A is 10, B is 11 and so on up to F (15) in hexadecimal, and up to Z (35) in base 36. Upper or lower case both work.