How to Convert Binary to Decimal
Each binary digit is worth a power of two, so converting binary to decimal means adding up the powers where a 1 appears. This guide shows the positional method, the doubling shortcut, and the code equivalents.
The positional method
Number the positions from the right starting at 0. Each position is worth 2 raised to that number - 1, 2, 4, 8, 16, and so on:
- Write the place value over each bit (1, 2, 4, 8, ... from the right).
- Keep the place values under the 1 bits; ignore the 0 bits.
- Add the kept values - the total is the decimal number.
The doubling shortcut (Horner's method)
Read the binary number left to right, starting from 0: double your running total and add the current bit. For 1011: 0→1→2→5→11. Double-and-add needs no powers of two and is the fastest hand method for long binary strings.
Reading long binary numbers
Group long binary into nibbles (4 bits) and convert each group to one hex digit first: 1111 0000 is F0, which is 240. Going through hex is usually faster and less error-prone than summing sixteen powers of two directly.
How 101101 converts from binary to decimal
Multiply each digit by 2 raised to its position (starting at 0 from the right), then add the results:
Sum: 45
Doing it in code
const binary = "1010";
const decimal = parseInt(binary, 2); // 10
// With 0b prefix:
const value = 0b1010; // 10Frequently Asked Questions
What is 1010 in decimal?
1010 in binary is 10 in decimal: 1×8 + 0×4 + 1×2 + 0×1 = 10. A handy coincidence for remembering how positional conversion works.
What is 11111111 in decimal?
11111111 is 255 - all eight bits of a byte set to 1. It equals 2⁸ - 1, which is why one byte holds values 0 through 255.
Do leading zeros change a binary number?
No. 00101 and 101 are both 5. Leading zeros only matter for fixed-width storage, where they show the register or field size rather than the value.