Binary to Decimal: Convert Binary Numbers

A hands-on, step-by-step guide from binary fundamentals to floating-point conversion and real programming applications

Number SystemsApril 13, 202610 min read

Binary Fundamentals: Why Base-2 Matters

Every computer at its core speaks a single language: binary. The processor in your laptop, the memory in your phone, the network card in your server — all of them manipulate electrical signals that are either on or off, high voltage or low voltage. These two states map naturally to the digits 1 and 0, creating the binary (base-2) number system.

While humans count in base-10 (decimal) because we have ten fingers, computers count in base-2 because transistors have two reliable states. Understanding the conversion between these two number systems is foundational knowledge for any developer, data scientist, or IT professional. You'll encounter binary in IP addresses, file permissions, color codes, network protocols, cryptography, and low-level programming.

In binary, each position represents a power of 2, just as each decimal position represents a power of 10. The rightmost digit is the ones place (2⁰ = 1), the next is the twos place (2¹ = 2), then fours (2² = 4), eights (2³ = 8), sixteens (2⁴ = 16), and so on. Each digit in a binary number is called a bit (binary digit).

Method 1: Positional Notation (The Standard Way)

The most intuitive method for converting binary to decimal is positional notation — multiply each bit by its corresponding power of 2 and sum the results.

Step-by-Step Example: Convert 101101 to Decimal

Write out each bit with its position number (starting from 0 on the right):

Binary Digit101101
Position543210
Power of 22⁵=322⁴=162³=82²=42¹=22⁰=1

Multiply each bit by its power of 2:

(1 × 32) + (0 × 16) + (1 × 8) + (1 × 4) + (0 × 2) + (1 × 1)

= 32 + 0 + 8 + 4 + 0 + 1

= 45

Binary 101101 equals decimal 45. Every bit that is 1 contributes its power-of-2 value; bits that are 0 contribute nothing.

Practice: Convert 11001010 to Decimal

Binary11001010
Position76543210
Value1286432168421

= 128 + 64 + 0 + 0 + 8 + 0 + 2 + 0 = 202

Method 2: Doubling Method (Mental Math)

The doubling method is a faster approach that works well for mental calculation. Start from the leftmost bit and work right, doubling the running total and adding each new bit:

Example: Convert 101101

  1. Start with the leftmost bit: 1
  2. Double it: 1 × 2 = 2. Add next bit: 2 + 0 = 2
  3. Double it: 2 × 2 = 4. Add next bit: 4 + 1 = 5
  4. Double it: 5 × 2 = 10. Add next bit: 10 + 1 = 11
  5. Double it: 11 × 2 = 22. Add next bit: 22 + 0 = 22
  6. Double it: 22 × 2 = 44. Add next bit: 44 + 1 = 45

Same result: 45. This method is often faster for mental calculation because you only need to track one running total instead of computing multiple powers of 2.

Common Binary Values to Memorize

Some binary values appear so frequently in computing that memorizing them saves significant time:

BinaryDecimalContext
000000011Lowest set bit
000000102Bit 1, Unix read permission
000001004Bit 2, Unix write permission
000010008Bit 3, Unix execute permission
0000111115Nibble mask (all 4 lower bits set)
01111111127Max 8-bit signed value, max ASCII
10000000128Sign bit in 8-bit signed, high bit set
11111111255Max 8-bit unsigned value, subnet mask
1000000002562⁸, byte boundary
111111111111111165,535Max 16-bit unsigned (0xFFFF)

The powers of 2 are worth memorizing entirely: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536. These numbers appear everywhere in computing — from memory sizes to network masks to color channels.

Floating-Point Binary to Decimal

Not all binary numbers are whole numbers. Binary fractions work similarly to decimal fractions, but with negative powers of 2.

Binary Fractions Explained

In a binary fraction, the bits to the right of the "decimal point" (actually called the radix point in binary) represent negative powers of 2:

Position-1-2-3-4
Power of 22⁻¹ = 0.52⁻² = 0.252⁻³ = 0.1252⁻⁴ = 0.0625

Example: Convert 101.101 to Decimal

Integer part (101): 4 + 0 + 1 = 5

Fractional part (.101): 0.5 + 0 + 0.125 = 0.625

Total: 5.625

IEEE 754 Floating Point

Real computers store fractional numbers using the IEEE 754 standard, which encodes floating-point numbers in three parts:

A single-precision float (32-bit) provides about 7 significant decimal digits of precision. A double-precision float (64-bit) provides about 15-16 significant digits. This is why 0.1 + 0.2 !== 0.3 in most programming languages — the binary representation of 0.1 is an infinitely repeating fraction (0.0001100110011...), just like 1/3 in decimal.

Binary in Programming: Practical Applications

Understanding binary-to-decimal conversion is directly useful in many programming scenarios:

Bitwise Operations

// Check if a number is even (rightmost bit is 0)
function isEven(n) { return (n & 1) === 0; }

// Check if the 3rd bit is set (value 4)
function hasFlag(flags) { return (flags & 4) !== 0; }

// Set multiple flags using binary OR
const READ = 4;    // 100
const WRITE = 2;   // 010
const EXEC = 1;    // 001
const permissions = READ | WRITE;  // 110 = 6

IP Addresses

IPv4 addresses are 32-bit binary numbers. The address 192.168.1.1 converts to binary as 11000000.10101000.00000001.00000001. Understanding this helps with subnet calculations. A /24 subnet mask (255.255.255.0) means the first 24 bits identify the network and the remaining 8 bits identify hosts on that network.

Color Codes

Hex color codes like #8B5CF6 are actually three 8-bit binary values packed together: 8B (139), 5C (92), F6 (246). Each component represents red, green, and blue as a decimal value from 0-255, stored as 8 binary bits. The alpha channel in RGBA adds a fourth 8-bit value for opacity.

File Permissions (Unix/Linux)

Unix file permissions use 3 bits per role (owner, group, others): read (4=100), write (2=010), execute (1=001). The permission chmod 755 means: owner gets 7 (rwx=111), group gets 5 (r-x=101), others get 5 (r-x=101). In binary: 111 101 101.

Quick Reference: Power of 2 Table

n2ⁿn2ⁿ
01101,024
12112,048
24124,096
38138,192
4161416,384
5321532,768
6641665,536
7128201,048,576
82562416,777,216
9512324,294,967,296

Convert Instantly with RiseTop

For quick conversions without manual calculation, RiseTop's Binary to Decimal Converter handles any binary number instantly — integers, fractions, and large numbers. Just paste your binary value and get the decimal result, plus step-by-step conversion breakdown so you can verify the math. It also supports the reverse conversion (decimal to binary) and shows both the positional and doubling methods.

Frequently Asked Questions

How do you convert binary to decimal?

To convert binary to decimal, multiply each binary digit by 2 raised to the power of its position (starting from 0 on the right), then sum all the values. For example, binary 1011 = (1×2³) + (0×2²) + (1×2¹) + (1×2⁰) = 8 + 0 + 2 + 1 = 11 in decimal.

What is the maximum value of an 8-bit binary number?

An 8-bit unsigned binary number can represent values from 0 to 255 (2⁸ - 1). The binary 11111111 equals 255 in decimal. If using two's complement for signed numbers, an 8-bit binary represents -128 to +127.

How do you convert decimal to binary?

To convert decimal to binary, repeatedly divide the decimal number by 2 and record the remainders from bottom to top. For example, 25 ÷ 2 = 12 remainder 1, 12 ÷ 2 = 6 remainder 0, 6 ÷ 2 = 3 remainder 0, 3 ÷ 2 = 1 remainder 1, 1 ÷ 2 = 0 remainder 1. Reading remainders bottom-to-top: 11001.

What is two's complement and how does it work?

Two's complement is a method for representing signed integers in binary. To negate a number, invert all bits and add 1. For example, 5 in 8-bit binary is 00000101. Its two's complement (negative 5) is 11111010 + 1 = 11111011. The leftmost bit indicates the sign: 0 for positive, 1 for negative.

Why do computers use binary instead of decimal?

Computers use binary because electronic circuits have two reliable states: on/off (voltage high/low), which naturally map to 1 and 0. Binary circuits are simpler, more reliable, and easier to manufacture than multi-state circuits. Transistors, the building blocks of processors, are essentially on/off switches.