Binary to Decimal Conversion: The Complete Reference
Binary to decimal conversion is the most common number-base translation you will do in programming, networking, and low-level debugging. Every IP address mask, every bitmask flag, and every ASCII character starts as binary and turns into a decimal number at some point. This reference covers two manual methods, common bit-length tables, and the quick online approach.
Method 1: Positional Notation (The Standard Way)
Binary is a base-2 system. Each position represents a power of 2, starting from 20 = 1 on the right and doubling as you move left.
| Position (from right) | 8th | 7th | 6th | 5th | 4th | 3rd | 2nd | 1st |
|---|---|---|---|---|---|---|---|---|
| Power of 2 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 |
| Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Write the binary digits under the place values. Add the place values wherever the bit is 1.
101101 to decimal:Write place values (right to left): 32, 16, 8, 4, 2, 1
1 × 32 = 320 × 16 = 01 × 8 = 81 × 4 = 40 × 2 = 01 × 1 = 132 + 8 + 4 + 1 = 45
Method 2: The Doubling Method (Faster for Long Strings)
This approach avoids writing out place values. Start from the leftmost bit and work right. Double your running total at each step, then add the current bit.
101101 using doubling:Start: total = 0
Bit 1: total = (0×2) + 1 = 1
Bit 2: total = (1×2) + 0 = 2
Bit 3: total = (2×2) + 1 = 5
Bit 4: total = (5×2) + 1 = 11
Bit 5: total = (11×2) + 0 = 22
Bit 6: total = (22×2) + 1 = 45
The doubling method works well in code too. Here is a JavaScript one-liner:
parseInt("101101", 2); // 45
And in Python:
int("101101", 2) # 45
Common Bit-Length Conversion Tables
4-Bit Nibble (0-15)
| Binary | Decimal | Binary | Decimal |
|---|---|---|---|
0000 | 0 | 1000 | 8 |
0001 | 1 | 1001 | 9 |
0010 | 2 | 1010 | 10 |
0011 | 3 | 1011 | 11 |
0100 | 4 | 1100 | 12 |
0101 | 5 | 1101 | 13 |
0110 | 6 | 1110 | 14 |
0111 | 7 | 1111 | 15 |
8-Bit Byte (0-255)
| Binary | Decimal | Use Case |
|---|---|---|
00000000 | 0 | Null byte, minimum value |
00001010 | 10 | Line feed (LF) |
00100000 | 32 | Space character (ASCII) |
01000001 | 65 | Uppercase A (ASCII) |
01100001 | 97 | Lowercase a (ASCII) |
01111111 | 127 | Delete character (ASCII) |
10000000 | 128 | Extended ASCII start |
11111111 | 255 | Maximum byte, subnet broadcast |
16-Bit Word (Selected Values)
| Binary | Decimal | Use Case |
|---|---|---|
00000000 00000000 | 0 | 16-bit zero |
00000011 11101000 | 1000 | Common port/ID range |
11111111 11111111 | 65,535 | Max 16-bit unsigned int |
01111111 11111111 | 32,767 | Max 16-bit signed int |
Real-World Uses of Binary-to-Decimal Conversion
Subnet Masks in Networking
A subnet mask like 11111111.11111111.11111111.00000000 converts to 255.255.255.0. Each octet is an 8-bit binary number translated to decimal. Network engineers do this conversion constantly when reading raw packet traces or configuring firewalls.
Unix File Permissions
The chmod command uses octal, but the underlying bit structure is binary. Permission rwxr-xr-- is bits 111 101 100, which converts to decimal 7-5-4, or chmod 754. Every 3-bit group is a decimal digit 0-7.
Bitmask Flags in Code
When you see flags = flags | 0x04 in C, you are seeing the decimal (or hex) version of binary 00000100. The constant 4 = binary 100 sets the third bit. Developers who can mentally convert between binary and decimal read bitmask code without reaching for a calculator.
Color Codes
RGB color rgb(255, 0, 128) stores each channel in an 8-bit byte. 255 = 11111111 (full red), 0 = 00000000 (no green), 128 = 10000000 (half blue). Game developers and graphics programmers think in these binary-to-decimal mappings daily.
Binary Fractions: Converting Numbers Less Than Zero
So far we handled integers. Binary fractions use negative powers of 2 after the binary point.
| Position | 1/2 | 1/4 | 1/8 | 1/16 | 1/32 |
|---|---|---|---|---|---|
| Value | 0.5 | 0.25 | 0.125 | 0.0625 | 0.03125 |
101.101 to decimal:Integer part: 101 = 4 + 0 + 1 = 5
Fractional part: .101 = 0.5 + 0 + 0.125 = 0.625
Result: 5.625
Floating-point numbers in IEEE 754 use this exact principle, except the binary point position is stored in an exponent field. Every decimal you see in JavaScript (0.1 + 0.2 = 0.30000000000000004) traces back to binary fractions that do not exactly represent the base-10 value.
Quick Conversion with an Online Binary Translator
Manual methods work for learning and quick mental math, but when you have a 32-bit memory address or a full-page hex dump, you want a binary translator that does the work. Paste the binary, get the decimal instantly.
The BinTranslate tool converts binary to decimal, text, and hex in one step. It shows the positional breakdown if you want to verify the math, and it handles any bit length you throw at it.