Number Base Converter

Type a number in binary, octal, decimal, hexadecimal or any base from 2 to 36 to see it in every other base at once, with the division and place-value working, fractions, and two's complement for negative numbers.

Fractions with a point (101.11) and a minus sign for negatives. Spaces and underscores between digits are ignored.

Any base from 2 to 36, e.g. 3, 5 or 36

Decimal (base 10)
237
Binary (base 2)
1110 1101
Octal (base 8)
355
Hexadecimal (base 16)
ED

Two's complement (signed binary)

Positive numbers are the plain binary padded with zeros. Bits with the top bit set read as negative when signed.

  • 8-bit1110 1101Hex ED · signed −19, unsigned 237
  • 16-bit0000 0000 1110 1101Hex 00ED · signed 237, unsigned 237
  • 32-bit0000 0000 0000 0000 0000 0000 1110 1101Hex 000000ED · signed 237, unsigned 237
  • 64-bit0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 1110 1101Hex 00000000000000ED · signed 237, unsigned 237

Decimal to binary: divide and multiply by 2

Whole part: divide by 2 and keep the remainders; read them from the bottom up.

DivideQuotientRemainder
237 ÷ 21181
118 ÷ 2590
59 ÷ 2291
29 ÷ 2141
14 ÷ 270
7 ÷ 231
3 ÷ 211
1 ÷ 201

= 11101101

How to use the base converter

  1. Type the number and choose the base it's in under "From". Fractions (101.11) and negative numbers (−42) work too.
  2. Read the decimal, binary, octal and hex answers at once; add any other base from 2 to 36 if you need it. Copy any answer with its button.
  3. Pick a base under "Show the working for" to see the division, multiplication or place-value steps your textbook asks for.

How base conversion works

To decimal: each digit is worth the base raised to its position. 11101101 in binary is 1×2⁷ + 1×2⁶ + 1×2⁵ + 0×2⁴ + 1×2³ + 1×2² + 0×2¹ + 1×2⁰ = 128 + 64 + 32 + 8 + 4 + 1 = 237. Digits after the point use negative powers: 0.1 in binary is 2⁻¹ = 0.5.

From decimal: divide the whole part by the new base again and again and read the remainders upwards; multiply the fraction by the new base again and again and read the whole parts downwards. 12.375 becomes 1100 (from 12) and .011 (0.375 × 2 = 0.75 → 0, 0.75 × 2 = 1.5 → 1, 0.5 × 2 = 1.0 → 1), so 1100.011.

Between binary, octal and hex: no arithmetic is needed. One octal digit is exactly three bits and one hex digit four bits, so group the bits from the point outwards and swap each group for its digit.

Worked example: 237

237 ÷ 2 gives remainders 1, 0, 1, 1, 0, 1, 1, 1, so 237 = 11101101 in binary. Grouped in fours that is 1110 1101 = ED in hex; in threes, 011 101 101 = 355 in octal. In 8 bits it fills all eight places, so as an unsigned byte it's 237 and as a signed byte it reads as 237 − 256 = −19.

0 to 15 in binary, octal and hex

DecimalBinaryOctalHex
0000000
1000111
2001022
3001133
4010044
5010155
6011066
7011177
81000108
91001119
10101012A
11101113B
12110014C
13110115D
14111016E
15111117F

Everything is worked out in your browser with exact whole-number arithmetic, so long numbers keep every digit.

Frequently asked questions

How do I convert decimal to binary?

Divide the number by 2 and write down the remainder, then divide the answer by 2 again, and keep going until you reach 0. The remainders read from the last to the first are the binary number. 13 ÷ 2 = 6 r 1, 6 ÷ 2 = 3 r 0, 3 ÷ 2 = 1 r 1, 1 ÷ 2 = 0 r 1, so 13 is 1101 in binary. The converter shows this table for any number.

How do I convert binary to hexadecimal?

Group the bits in fours from the right (add zeros on the left if needed) and replace each group with one hex digit: 0000 = 0 up to 1111 = F. 11101101 becomes 1110 1101, which is E D, so ED. For octal, use groups of three: 011 101 101 is 355.

What is two's complement?

It is how computers store negative whole numbers. In n bits, −N is stored as 2ⁿ − N, which you get by writing N in binary, flipping every bit and adding 1. In 8 bits, 5 is 00000101, flipped 11111010, plus 1 is 11111011 (FB in hex). An 8-bit signed number holds −128 to 127. Choose 8, 16, 32 or 64 bits to read binary or hex input as signed.

Why does 0.1 never end in binary?

A fraction ends in a base only when its denominator's prime factors divide that base. 0.1 = 1/10 has a factor 5, which doesn't divide 2, so in binary it repeats for ever: 0.0(0011), where the digits in brackets repeat. 0.5, 0.25 and 0.375 end, because their denominators are powers of 2.

Which digits does a base above 10 use?

The digits 0–9 and then letters: A = 10, B = 11, up to Z = 35 in base 36. Hexadecimal (base 16) uses 0–9 and A–F. Letters can be typed in upper or lower case.

Can I paste numbers with 0x or 0b in front?

Yes. 0x (hex), 0b (binary) and 0o (octal) prefixes are accepted when they match the base you chose, and spaces or underscores between digits are ignored, so 0b1110_1101 and 1110 1101 both work.

More text and developer tools

See all text and developer tools →

Can't find the tool you need? Tell us, and the most requested tools get built first.