Binary and decimal
Binary (base 2) is how hardware stores every number: each digit is a bit, worth a power of 2. Decimal (base 10) is the everyday system: each digit is worth a power of 10.
Students meet it in their first programming or digital electronics class; developers use it to read bit flags, masks and register values.
This page opens the base converter with binary as the input; it shows binary, octal, decimal, hexadecimal and Base64 at once, accepts prefixes such as 0x, 0b and 0o, and works with numbers of any length (no 2^53 limit). It runs in your browser.
Binary vs decimal
| Binary | decimal | |
|---|---|---|
| Base | 2 | 10 |
| Digits | 0 1 | 0–9 |
| Prefix in code | 0b | — |
| 255 is written | 11111111 | 255 |
How to convert binary to decimal by hand
Multiply each digit by the power of 2 of its position (counting from 0 on the right) and add everything. For 10011100:
1 × 2^7 + 0 × 2^6 + 0 × 2^5 + 1 × 2^4 + 1 × 2^3 + 1 × 2^2 + 0 × 2^1 + 0 × 2^0
= 128 + 0 + 0 + 16 + 8 + 4 + 0 + 0
= 156Binary to decimal table
Values computed by the converter itself:
| Binary | Decimal |
|---|---|
0 | 0 |
1 | 1 |
10 | 2 |
111 | 7 |
1000 | 8 |
1010 | 10 |
1111 | 15 |
10000 | 16 |
100000 | 32 |
1000000 | 64 |
1100100 | 100 |
1111111 | 127 |
11111111 | 255 |
100000000 | 256 |
1111101000 | 1000 |
10000000000 | 1024 |
1000000000000 | 4096 |
1111111111111111 | 65535 |
Binary to decimal in code
JavaScript
parseInt('10011100', 2); // 156Python
int("10011100", 2) # 156For integers beyond 2^53 in JavaScript, use BigInt: BigInt("0x…").toString(10).
Frequently asked questions
Does it handle very large numbers?
Yes. The converter uses arbitrary-precision integers (BigInt), so a 256-bit hash or a 100-digit number converts exactly; JavaScript Number would lose digits above 2^53.
Can I convert negative numbers or fractions?
Negative integers keep their sign (-255 → -FF); the tool does not write two’s complement or fractional digits. For a two’s complement byte, add 256 first (−1 → 255 → FF).
Why do programmers use hexadecimal instead of binary?
Because it is binary in short form: 4 bits per digit, 2 digits per byte, so 0xFF is easier to read than 11111111 and still maps bit for bit.