CalcMountain

Binary to Decimal Converter

Convert between binary (base 2) and decimal (base 10) number systems. Enter a decimal number to see its binary representation with bit grouping and place values.

Binary is the native language of computers. Every photo on your phone, every character you type, every pixel on your screen — all of it is stored as patterns of ones and zeros. Each "bit" (binary digit) is a switch that's either on (1) or off (0), and groups of bits combine to encode numbers, letters, and instructions. Understanding the binary-to-decimal conversion is the foundation of computer science, digital electronics, and any low-level programming work.

Decimal (base 10) is what humans use because we have ten fingers. Binary (base 2) is what machines use because transistors have two stable states — voltage high or voltage low. The conversion between the two is purely mechanical: each bit position represents a power of 2, and adding up the powers where bits are "on" gives the decimal value. This calculator handles the math both ways: enter a decimal number to see its binary form (with place values visualized), or read a binary string to get its decimal equivalent.

You'll encounter binary anywhere data meets hardware: setting subnet masks in networking, debugging embedded firmware, decoding ASCII or Unicode codepoints, understanding bitwise operators in code, or just reading a kernel panic. Once you can convert by hand, the patterns become intuitive — 256, 512, 1024, 65536 stop being arbitrary numbers and start looking like the round-number powers of 2 that they are.

Inputs

Results

Decimal

42

Binary

0010 1010

Bit Count

6 bits

Bytes

1 bytes

Place Values

BitPosition (2^n)Value
1532
138
112
Last updated:

Formula

**Binary to decimal (positional notation):** decimal = Σ (bit_i × 2^i) for i from 0 to n-1 Where bit_i is the value (0 or 1) at position i, counted from the right starting at 0. **Example: 1101₂ → ?** - Position 3: 1 × 2³ = 8 - Position 2: 1 × 2² = 4 - Position 1: 0 × 2¹ = 0 - Position 0: 1 × 2⁰ = 1 - Total: 8 + 4 + 0 + 1 = **13₁₀** **Decimal to binary (repeated division by 2):** Divide the decimal number by 2, record the remainder (0 or 1), then divide the quotient by 2 again. Repeat until quotient is 0. Read the remainders bottom-up. **Example: 13₁₀ → ?** - 13 ÷ 2 = 6 r 1 - 6 ÷ 2 = 3 r 0 - 3 ÷ 2 = 1 r 1 - 1 ÷ 2 = 0 r 1 - Read bottom-up: **1101₂** **Common bit widths and their max values (unsigned):** - 4 bits (nibble): 0–15 - 8 bits (byte): 0–255 - 16 bits (word): 0–65,535 - 32 bits (int): 0–4,294,967,295 - 64 bits (long): 0–18,446,744,073,709,551,615 **Powers of 2 worth memorizing:** 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536.

How to use this calculator

  1. Enter a decimal value in the input field (any non-negative integer up to 2³² − 1).
  2. Read the binary representation with bit positions and place values shown.
  3. Note the bit width — values up to 255 fit in a byte, up to 65,535 in two bytes, etc.
  4. For ASCII conversions, look up the decimal codepoint first (A = 65, a = 97, space = 32), then convert.
  5. For subnet masks, convert each octet (0–255) of the dotted-decimal address separately.
  6. Use the place-value visualization to spot patterns: powers of 2 are always a single 1 followed by zeros.

Worked examples

Decoding an ASCII character

**Scenario:** You're reverse-engineering a binary file and find the byte 01001000. What letter does it represent in ASCII? **Calculation:** Convert 01001000 to decimal: 64 + 8 = 72. ASCII 72 = uppercase "H". **Result:** The byte represents the letter "H". The next byte 01100101 (101 decimal) is "e", then 01101100 (108) "l", and so on — likely the start of "Hello".

Calculating a network subnet

**Scenario:** You need to understand the subnet mask 255.255.255.224 (/27) for a /27 network. **Calculation:** Last octet 224 → 11100000 binary. The three leftmost 1-bits identify the network portion of the last octet; the five 0-bits are host bits, giving 2⁵ = 32 addresses per subnet (30 usable hosts after subtracting network + broadcast). **Result:** A /27 network has 32 addresses with 30 usable hosts. Each /27 block starts on a multiple of 32: .0, .32, .64, .96, .128, .160, .192, .224.

Understanding RGB color values

**Scenario:** You're working with a 24-bit color value where each channel (red, green, blue) is one byte. How many distinct colors are possible? **Calculation:** Each channel: 8 bits = 256 values (0–255). Total: 256 × 256 × 256 = 2²⁴ = 16,777,216 unique colors. This is why displays are called "24-bit" or "true color" — that's the bit depth per pixel. **Result:** A 24-bit RGB display can show ~16.8 million colors. Adding an 8-bit alpha channel makes it 32-bit color (RGBA), used everywhere from PNG files to modern GPUs.

When to use this calculator

**Use binary conversion when you need to:**

- **Read or debug low-level code:** kernel logs, hardware registers, machine code listings, or assembly output all use binary or hex (which maps directly to binary in groups of 4). - **Configure networking:** subnet masks, CIDR notation, IP address ranges, and VLAN bitmaps all require binary thinking. - **Work with bitwise operations:** flags packed into single integers (permissions, feature toggles, hardware control bits) are manipulated with AND, OR, XOR, and shift operators. - **Understand floating-point precision:** IEEE 754 single-precision uses 1 sign bit + 8 exponent bits + 23 mantissa bits. Knowing this explains why 0.1 + 0.2 ≠ 0.3 exactly in most languages. - **Decode file formats:** PNG chunks, JPEG markers, MP3 frame headers, executable file headers — binary file forensics is bit-level work. - **Learn or teach computer science fundamentals:** before you can grok Big-O, complexity, or algorithms, the base-2 number system is foundational.

**Quick mental shortcuts:** - Doubling shifts left by one bit (×2 = append a 0). - Halving (integer division) shifts right by one bit. - AND with a mask isolates bits; OR sets bits; XOR toggles bits. - A number is even iff its lowest bit is 0. - A number is a power of 2 iff exactly one bit is set (test: `n & (n-1) == 0` for n > 0).

Common mistakes to avoid

  • Reading bits left-to-right and assuming position 0 is on the left — bit 0 is always the **rightmost** (least significant) bit.
  • Forgetting the implicit leading zeros: 1011 and 00001011 are the same value (11), just padded to 4 vs 8 bits.
  • Confusing signed and unsigned representations. In 8-bit two's complement, 11111111 is −1, not 255. The interpretation depends on the type.
  • Treating binary like a string and concatenating instead of using bitwise shifts. "Append a 0 bit" means multiply by 2, not append the character "0" to a string.
  • Off-by-one errors on bit width: an N-bit unsigned integer holds 2^N values (0 to 2^N − 1), not 2^N − 1 values.
  • Mixing up nibble, byte, word, dword: a nibble is 4 bits, byte is 8, word historically is 16 (still 16 on x86 assembly), dword is 32.
  • Confusing binary prefixes with decimal SI prefixes: 1 KB might mean 1,000 bytes (storage marketing) or 1,024 bytes (memory). IEC introduced KiB, MiB, GiB to disambiguate.

Frequently Asked Questions

Sources & further reading

SponsoredShop Top Deals on AmazonSupport CalcMountain — browse top-rated products at no extra cost to you.

Related Calculators