The Standard Engine.
MathematicsFinanceHealthPhysicsEngineeringBrowse all

Everyday Life · Unit Conversions · Digital & Data

Binary to Decimal Converter

Converts a binary (base-2) number to its decimal (base-10) equivalent using positional notation.

Calculator

Advertisement

Formula

D is the resulting decimal value. b_i is the binary digit (0 or 1) at position i, counted from the rightmost digit (least significant bit). n is the total number of binary digits. Each bit is multiplied by 2 raised to its positional power, and all products are summed to give the decimal result.

Source: Knuth, D. E. — The Art of Computer Programming, Vol. 2: Seminumerical Algorithms. Addison-Wesley, 1997.

How it works

The binary number system uses only two digits — 0 and 1 — to represent all numeric values. Every digit in a binary number corresponds to a specific power of 2, determined by its position. The rightmost digit represents 2⁰ (which equals 1), the next digit to the left represents 2¹ (equals 2), then 2² (equals 4), 2³ (equals 8), and so on. This is directly analogous to how the decimal system works with powers of 10. Because each position either includes or excludes that power of 2, binary is the natural fit for electronic systems where a switch is either on (1) or off (0).

The conversion formula is a weighted sum: D = Σ (b_i × 2^i), where each binary digit b_i is multiplied by 2 raised to its positional index i, counting from zero at the rightmost position. All of these products are added together to produce the final decimal number. For example, the binary number 1011 breaks down as (1 × 2³) + (0 × 2²) + (1 × 2¹) + (1 × 2⁰) = 8 + 0 + 2 + 1 = 11 in decimal. The formula is exact and lossless for all non-negative integers — no approximation is involved.

This conversion is used constantly in computing contexts: reading memory addresses, understanding IP subnetting in networking (IPv4 addresses are 32-bit binary numbers), decoding colour values in hexadecimal (which map directly through binary), working with assembly language or machine code, and debugging hardware registers. Even everyday tasks like setting file permissions in Unix/Linux (e.g., chmod 755) involve binary representations. The calculator also reports the number of bits in the input and the value of the most significant bit, which helps contextualise where the number sits within standard data widths like 8-bit (byte), 16-bit (word), or 32-bit (double word).

Worked example

Let's convert the binary number 11010110 to decimal step by step.

First, identify the positions. The number has 8 bits, so positions run from 7 (leftmost) down to 0 (rightmost):

Bit 7: 1 × 2⁷ = 1 × 128 = 128
Bit 6: 1 × 2⁶ = 1 × 64 = 64
Bit 5: 0 × 2⁵ = 0 × 32 = 0
Bit 4: 1 × 2⁴ = 1 × 16 = 16
Bit 3: 0 × 2³ = 0 × 8 = 0
Bit 2: 1 × 2² = 1 × 4 = 4
Bit 1: 1 × 2¹ = 1 × 2 = 2
Bit 0: 0 × 2⁰ = 0 × 1 = 0

Sum: 128 + 64 + 0 + 16 + 0 + 4 + 2 + 0 = 214

So binary 11010110 equals decimal 214. This is a valid unsigned 8-bit value (range 0–255). The most significant bit value is 2⁷ = 128, confirming this is an 8-bit number.

Limitations & notes

This calculator handles non-negative integer binary numbers only — it does not support signed representations such as two's complement (used for negative integers in most processors), floating-point binary (IEEE 754), or binary-coded decimal (BCD). If you enter a binary string with digits other than 0 and 1, the result will be invalid. Very large binary numbers (more than 52 bits) may lose precision due to JavaScript's floating-point number representation, which provides approximately 15–17 significant decimal digits. For cryptographic, arbitrary-precision, or signed integer work, use a dedicated programming environment or big-integer library. This tool also does not handle binary fractions (e.g., 101.11) — only whole-number binary inputs are supported.

Frequently asked questions

How do you manually convert binary to decimal?

Write out each binary digit and assign it a positional power of 2, starting at 2⁰ for the rightmost digit. Multiply each digit (0 or 1) by its corresponding power of 2, then add all the products together. For example, binary 1101 = (1×8) + (1×4) + (0×2) + (1×1) = 13 in decimal.

What is the largest decimal number an 8-bit binary number can represent?

An 8-bit binary number can represent values from 0 (00000000) to 255 (11111111). This is because the maximum value is 2⁸ − 1 = 255. This range is why a single byte can store colour channel values (0–255 for RGB) or unsigned single-byte integers in computing.

Is binary to decimal conversion lossless?

Yes, for non-negative integers within standard precision limits, the conversion is perfectly exact and lossless. Every binary integer maps to exactly one decimal integer and vice versa. No rounding or approximation occurs. The only precision concern arises with extremely large numbers exceeding JavaScript's 53-bit safe integer limit (Number.MAX_SAFE_INTEGER = 9,007,199,254,740,991).

How does binary relate to hexadecimal?

Hexadecimal (base 16) is a shorthand for binary. Every group of 4 binary digits (a nibble) maps directly to one hexadecimal digit (0–9, A–F). For example, binary 1010 = hex A = decimal 10. This is why hexadecimal is so common in programming — it compresses long binary strings into a more readable format while preserving the direct bit-level correspondence.

What is two's complement and why doesn't this calculator use it?

Two's complement is the standard method CPUs use to represent signed (positive and negative) integers in binary. In an 8-bit two's complement system, the leftmost bit signals the sign: 0 means positive, 1 means negative. For example, 11111111 represents −1, not 255. This calculator performs simple unsigned positional conversion, treating all bits as magnitude bits. For signed binary interpretation, a dedicated two's complement calculator should be used.

Last updated: 2025-01-15 · Formula verified against primary sources.