Reading binary numbers
Binary is base 2: each digit (bit) is worth twice the one to its right. From the right, the positions are worth 1, 2, 4, 8, 16, 32 and so on. To convert, add the values of the positions that hold a 1.
Computers store everything in binary, so binary to decimal comes up when reading bit masks, network masks, permission bits, register values in datasheets and exercises in programming courses.
Worked example
101010 has ones at positions 5, 3 and 1 (counting from 0 on the right): 32 + 8 + 2 = 42. A full byte, 11111111, is 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255, the largest value 8 bits can hold.
Long numbers
This page uses arbitrary-precision integers, so a 64-bit or 128-bit value converts exactly. 1 followed by 64 zeros is 2^64 = 18,446,744,073,709,551,616, a number many calculators round.
How this works
The page reads the digits from left to right and keeps a running total: for each bit it doubles the total and adds the bit (Horner's method). This gives the same result as summing powers of two, and with JavaScript's BigInt it stays exact for numbers of any length. Spaces and underscores used to group bits are ignored, and a 0b prefix or minus sign is accepted. The result is shown in decimal, and the table lists the same value in binary, octal and hex with its length in bits. Each line converts separately.
Frequently asked
How do I convert binary to decimal by hand?
Write the powers of two under the digits from the right (1, 2, 4, 8…) and add the ones under a 1. 1101 = 8 + 4 + 1 = 13.
What is the largest number in 8 bits?
11111111 = 255. With 16 bits it is 65,535, and with 32 bits 4,294,967,295.
Does it handle negative numbers?
Yes, with a minus sign. Two's-complement values like 11111111 for −1 are read as the unsigned number 255.
Is there a length limit?
No practical limit: the page uses exact big integers.
Sources
- ECMA-262 — ECMAScript Language Specification
- ISO 80000-1:2022 — Quantities and units — Part 1: General
- Wikipedia — Binary number
Reviewed Oct 17, 2026 · test vectors fixtures/dev/binary-to-decimal/