Skip to main content
Screendesk
Free tool

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 GitHub

Number

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

Fits in 32 bitsSigned range -2,147,483,648 to 2,147,483,647, unsigned 0 to 4,294,967,295

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.

Binary to decimal

101101 to decimal, bit by bit. Add the place value of every 1 bit.

Converting binary 101101 to decimal
BitPlace valueDecimal
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
Sum32 + 8 + 4 + 1101101 = 45
Decimal to binary

156 to binary, by repeated division. The remainders are the bits, lowest first.

Converting decimal 156 to binary
DivisionQuotientRemainder (bit)
156 ÷ 2780
78 ÷ 2390
39 ÷ 2191
19 ÷ 291
9 ÷ 241
4 ÷ 220
2 ÷ 210
1 ÷ 201
Read remainders bottom to top156 = 1001 1100
Reference

Powers of two and 8-bit signed values. The numbers behind byte sizes and integer limits.

Powers of two
PowerDecimalWhy it matters
2⁰1Lowest bit
2⁴16One nibble holds 0–15
2⁷128Top bit of a byte; sign bit in 8-bit signed values
2⁸256Values in one byte
2¹⁰1,024One kibibyte (KiB)
2¹⁶65,536Values in 16 bits
2³¹2,147,483,648One past the largest signed 32-bit integer
2³²4,294,967,296Values in 32 bits; IPv4 address space
2⁵³9,007,199,254,740,992JavaScript numbers lose integer precision above this
2⁶⁴18,446,744,073,709,551,616Values in 64 bits
8-bit two’s complement examples
DecimalBinary (8-bit)Hex
00000 00000x00
10000 00010x01
1000110 01000x64
1270111 11110x7F (largest 8-bit signed)
−11111 11110xFF
−1001001 11000x9C
−1271000 00010x81
−1281000 00000x80 (smallest 8-bit signed)
FAQ

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.

Customer support runs on Screendesk.

Start for free