Binary to Decimal Converter
Convert binary to decimal, or decimal to binary, as you type. Bits grouped into nibbles, any size, and two’s complement for negative numbers.
Open source on GitHubNumber
Whole numbers of any size. A leading minus sign, 0x / 0b / 0o prefixes, and spaces or underscores between digits are fine.
Result
Decimal (base 10)
45
Binary (base 2)
10 1101
Octal (base 8)
55
Hexadecimal (base 16)
2D
6 bits · 2 decimal digits
Two’s complement
Bit pattern
0000 0000 0000 0000 0000 0000 0010 1101
Hex
0x00 00 00 2D
As signed integer
45
As unsigned integer
45
Runs entirely in your browser. Nothing you type here is uploaded or stored.
101101 to decimal, bit by bit. Add the place value of every 1 bit.
| Bit | Place value | Decimal |
|---|---|---|
| 1 (bit 5) | 1 × 2⁵ | 32 |
| 0 (bit 4) | 0 × 2⁴ | 0 |
| 1 (bit 3) | 1 × 2³ | 8 |
| 1 (bit 2) | 1 × 2² | 4 |
| 0 (bit 1) | 0 × 2¹ | 0 |
| 1 (bit 0) | 1 × 2⁰ | 1 |
| Sum | 32 + 8 + 4 + 1 | 101101 = 45 |
156 to binary, by repeated division. The remainders are the bits, lowest first.
| Division | Quotient | Remainder (bit) |
|---|---|---|
| 156 ÷ 2 | 78 | 0 |
| 78 ÷ 2 | 39 | 0 |
| 39 ÷ 2 | 19 | 1 |
| 19 ÷ 2 | 9 | 1 |
| 9 ÷ 2 | 4 | 1 |
| 4 ÷ 2 | 2 | 0 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
| Read remainders bottom to top | 156 = 1001 1100 |
Powers of two and 8-bit signed values. The numbers behind byte sizes and integer limits.
| Power | Decimal | Why it matters |
|---|---|---|
| 2⁰ | 1 | Lowest bit |
| 2⁴ | 16 | One nibble holds 0–15 |
| 2⁷ | 128 | Top bit of a byte; sign bit in 8-bit signed values |
| 2⁸ | 256 | Values in one byte |
| 2¹⁰ | 1,024 | One kibibyte (KiB) |
| 2¹⁶ | 65,536 | Values in 16 bits |
| 2³¹ | 2,147,483,648 | One past the largest signed 32-bit integer |
| 2³² | 4,294,967,296 | Values in 32 bits; IPv4 address space |
| 2⁵³ | 9,007,199,254,740,992 | JavaScript numbers lose integer precision above this |
| 2⁶⁴ | 18,446,744,073,709,551,616 | Values in 64 bits |
| Decimal | Binary (8-bit) | Hex |
|---|---|---|
| 0 | 0000 0000 | 0x00 |
| 1 | 0000 0001 | 0x01 |
| 100 | 0110 0100 | 0x64 |
| 127 | 0111 1111 | 0x7F (largest 8-bit signed) |
| −1 | 1111 1111 | 0xFF |
| −100 | 1001 1100 | 0x9C |
| −127 | 1000 0001 | 0x81 |
| −128 | 1000 0000 | 0x80 (smallest 8-bit signed) |
More free tools. Free, open source, no sign-up. See all tools · Source on GitHub
Frequently asked questions
How do I convert binary to decimal?
Number the bits from 0 on the right. Each 1 bit is worth 2 raised to its position; add those values together. For 101101 the 1 bits are at positions 5, 3, 2, and 0, so the value is 32 + 8 + 4 + 1 = 45. Type a binary number above and the decimal value updates as you type.
How do I convert decimal to binary?
Divide the number by 2 and write down the remainder (0 or 1), then keep dividing the quotient by 2 until it reaches 0. The remainders read from the last one to the first are the binary digits: 156 becomes 10011100. Press Swap above, or set From to Decimal and To to Binary.
How are negative numbers written in binary?
Computers use two’s complement: invert every bit of the positive value and add 1. In 8 bits, 100 is 0110 0100, so −100 is 1001 1011 + 1 = 1001 1100. The leftmost bit is the sign bit. Enter a negative decimal number and pick a width in the two’s complement panel to see the stored pattern.
Why are binary digits grouped in fours?
Four bits (a nibble) map to exactly one hexadecimal digit, and eight bits make a byte, so grouping by four makes long values easier to read and to check against hex. Spaces and underscores in your input are ignored, so you can paste 1001_1100 or 1001 1100.
How many bits do I need for a number?
An unsigned value n needs ⌊log₂ n⌋ + 1 bits, so 255 needs 8 bits and 256 needs 9. Signed values need one extra bit for the sign. The converter shows the bit length of every result and flags an overflow when the value does not fit in the width you choose.