To convert binary to decimal, set From Base to Base 2 - Binary and To Base to Base 10 - Decimal, or select Swap Bases from the default decimal-to-binary setup. Then type the binary number. You can also paste it with a 0b prefix. The result updates as you type, and the Decimal box always shows the base 10 value.
How to convert binary to decimal
- Set the bases. The converter opens on decimal to binary. Select Swap Bases to reverse the direction, or pick any pair from From Base and To Base.
- Enter the number. Type or paste it in Source value. Spaces and underscores between digits are ignored, so 1111 0000 and 1111_0000 both work. With Auto-detect prefixes on, 0b1010, 0o17 and 0xFF switch the source base for you.
- Read the result. Converted Output shows the answer, and the four boxes below show binary, octal, decimal and hexadecimal together. Analysis adds the bit length and sign.
- Copy it. Copy Result copies the main answer. Copy All copies the input and all four bases as text.
Binary place values: converting by hand
Each binary digit (bit) stands for a power of 2, starting with 1 on the right and doubling as you move left: 1, 2, 4, 8, 16, 32 and so on. Add up the values where the bit is 1.
Example: 101101
| Place value | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|
| Bit | 1 | 0 | 1 | 1 | 0 | 1 |
32 + 8 + 4 + 1 = 45. So binary 101101 is decimal 45.
Fractions work the same way to the right of the point, with place values of 1/2, 1/4, 1/8 and so on. Binary 1010.101 is 8 + 2 + 0.5 + 0.125 = 10.625.
Decimal to binary: the divide-by-2 method
Divide the number by 2 again and again, writing down each remainder, until you reach 0. Then read the remainders from the last one to the first.
Example: 156 ÷ 2 = 78 r0, 78 ÷ 2 = 39 r0, 39 ÷ 2 = 19 r1, 19 ÷ 2 = 9 r1, 9 ÷ 2 = 4 r1, 4 ÷ 2 = 2 r0, 2 ÷ 2 = 1 r0, 1 ÷ 2 = 0 r1. Reading upwards gives 10011100. Check it: 128 + 16 + 8 + 4 = 156.
The converter does this instantly. With Pad binary to full bytes on, results are padded with leading zeros to a multiple of 8 bits, and Digit Grouping splits them into blocks of 4 (the default) or 8 so long numbers are easier to read.
Decimal to hex and hex to decimal
Hexadecimal is base 16. It uses 0-9 and then A-F for 10 to 15. Each place is worth 16 times the one to its right: 1, 16, 256, 4,096.
- Hex to decimal: 2AF = 2 × 256 + 10 × 16 + 15 × 1 = 512 + 160 + 15 = 687.
- Decimal to hex: divide by 16 and keep the remainders. 500 ÷ 16 = 31 r4, 31 ÷ 16 = 1 r15 (F), 1 ÷ 16 = 0 r1. Reading upwards gives 1F4.
- Hex to binary: each hex digit is exactly 4 bits, so FF is 1111 1111 and 1F4 is 0001 1111 0100.
Octal (base 8) groups bits in threes instead: decimal 64 is 100 in octal. Programmers see hex in color codes; the RGB to HEX converter handles those directly.
Signed binary to decimal (two's complement)
Computers usually store negative whole numbers in two's complement. In an 8-bit value, the leftmost bit is the sign: if it's 1, the number is negative.
To read 11111011 as a signed 8-bit number, invert every bit to get 00000100, add 1 to get 00000101, which is 5, and put a minus sign in front: -5. A shortcut: read it as unsigned (251) and subtract 256.
By default the converter reads numbers as written, so 11111011 converts to 251, and a minus sign makes a value negative (-1010 gives -10). Set Signed binary to Two's complement, 8-bit and the same 11111011 gives -5. It works the other way too: enter -5 in decimal with binary as the target and you get 11111011. Widths of 8, 16, 32, 64 and 128 bits are available, and a value that doesn't fit the chosen width shows a message instead of a wrong answer.
Number base converter for bases 2 to 36 and text
Both base lists run from 2 to 36, using the letters A-Z as digits above 9, so you can convert to base 36 or base 5 as easily as to hex. Whole numbers are calculated with JavaScript BigInt, so even very long values stay exact. Fraction Precision sets how many digits appear after the point (8 by default) when a fraction doesn't end.
The Text ⇄ Number Utilities panel turns text into its UTF-8 bytes in the output base, for example "Hi" in hex is 48 69. To turn readable text into binary and back, the binary translator is quicker.
Frequently asked questions
How do you read a binary number in decimal?
Multiply each bit by its place value (1, 2, 4, 8, 16 and so on from the right) and add the results. Binary 1101 is 8 + 4 + 0 + 1 = 13.
How do you convert decimal to binary?
Divide the number by 2 repeatedly and note each remainder, then read the remainders from bottom to top. Decimal 13 gives remainders 1, 0, 1, 1, so it's 1101 in binary.
What is 255 in binary and hex?
255 is 11111111 in binary and FF in hexadecimal. It's the largest number one byte (8 bits) can hold.
Does the converter handle negative numbers?
Yes, with a minus sign: -255 converts to -FF in hex. For signed fixed-width values, set Signed binary to a two's complement width such as 8-bit; then 11111011 reads as -5 and -5 is shown as 11111011.
Can I convert binary fractions?
Yes. Enter a value with a point, such as 1010.101, and it converts to 10.625. Choose up to 24 digits in Fraction Precision for fractions that repeat.
Is there a limit on how long the number can be?
Whole numbers have no fixed limit, because the converter uses exact big-integer maths in your browser. Very long inputs only depend on your device's memory and speed.