Binary ↔ Decimal Converter

Convert between binary (base-2) and decimal (base-10) number systems with ease. Essential for computer science, digital electronics, programming, and understanding how computers represent and process numerical data.

Base-2 System
Mathematical
Computer Science
Digital Systems

Binary ↔ Decimal Converter

Convert between binary (base-2) and decimal (base-10) number systems with detailed explanations

Quick Examples

Click on any example to try the conversion

42
Decimal
1010
Binary
255
Decimal
11111111
Binary
128
Decimal

Binary-Decimal Reference

Quick reference for common binary and decimal equivalents

Small Numbers (0-15)

0000
0
0001
1
0010
2
0011
3
0100
4
0101
5
0110
6
0111
7
1000
8
1001
9
1010
10
1011
11
1100
12
1101
13
1110
14
1111
15

Powers of 2

2^011
2^1210
2^24100
2^381000
2^41610000
2^532100000
2^6641000000
2^712810000000
2^8256100000000
2^95121000000000
2^10102410000000000

Conversion Tips

Quick methods and shortcuts for binary-decimal conversion

Decimal to Binary Shortcuts

  • • Powers of 2 are easy: 8 = 1000, 16 = 10000
  • • For small numbers, memorize 0-15 in binary
  • • Use the division by 2 method for larger numbers
  • • Each bit position represents a power of 2

Binary to Decimal Shortcuts

  • • Start from the rightmost bit (2^0 = 1)
  • • Each position left doubles the value
  • • Only add values where the bit is 1
  • • 1111 in binary always equals 2^n - 1

How to Use the Binary-Decimal Converter

Master binary and decimal number system conversions

1Choose Conversion Direction

Select the type of conversion you need:

  • Decimal to Binary: Convert 25 → 11001
  • Binary to Decimal: Convert 1101 → 13
  • Auto-detect: Automatically recognize input format
  • Batch Mode: Convert multiple numbers at once

2Enter Your Number

Input your number in the appropriate format:

  • Decimal: Regular numbers (0-9)
  • Binary: Only 0s and 1s (e.g., 101010)
  • Validation: Real-time format checking
  • Large Numbers: Support for extensive bit patterns

3View Detailed Results

Get comprehensive conversion information:

Input: 42 (decimal)
Binary: 101010
Breakdown: 32 + 8 + 2 = 42

4Learn and Apply

Understand the conversion process:

  • • See step-by-step binary arithmetic
  • • Learn place value systems
  • • Copy results for programming and calculations

Understanding Binary Numbers

Learn how the binary number system works and why it's fundamental to computing

What is Binary?

Binary is a base-2 number system that uses only two digits: 0 and 1. Each position represents a power of 2, making it perfect for digital systems where components can be either "on" (1) or "off" (0).

Place Values in Binary


8

4

2
2⁰
1
1
0
1
1

1011₂ = (1×8) + (0×4) + (1×2) + (1×1) = 11₁₀

Why Binary Matters

Binary is the foundation of all digital technology because electronic circuits can easily represent two states: high voltage (1) and low voltage (0).

Digital Electronics

Transistors can be on/off, representing 1/0

Computer Memory

All data stored as sequences of bits (binary digits)

Programming

Bitwise operations and low-level optimization

Network Communication

Data transmission as binary signals

Conversion Methods

Decimal to Binary

Divide by 2, keep track of remainders:

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
Result: 11001

Binary to Decimal

Multiply each digit by its place value:

1101₂ = 1×8 + 1×4 + 0×2 + 1×1
= 8 + 4 + 0 + 1
= 13₁₀

Common Binary Patterns

0
0
1
1
10
2
11
3
100
4
101
5
110
6
111
7
1000
8

Real-World Applications

Discover where binary-decimal conversion is essential in technology and science

Computer Programming

Essential for bitwise operations, memory addressing, binary flags, and understanding how computers store and process data at the lowest level.

int flags = 0b1010; // Binary literal
if (flags & 0b0010) // Bitwise AND

Digital Electronics

Design and analyze digital circuits, understand logic gates, and work with microcontrollers and embedded systems.

AND Gate: 1 & 1 = 1
OR Gate: 1 | 0 = 1
XOR Gate: 1 ⊕ 1 = 0

Network Engineering

Calculate subnet masks, understand IP addressing, configure network devices, and analyze network protocols.

IP: 192.168.1.1
Binary: 11000000.10101000.00000001.00000001

Data Analysis

Understand data encoding, file formats, compression algorithms, and binary data structures in databases and file systems.

Color RGB: (255, 128, 64)
Binary: 11111111 10000000 01000000

Computer Science Education

Learn fundamental concepts of computer science, algorithms, data structures, and computational thinking.

Powers of 2: 1, 2, 4, 8, 16, 32, 64...
Bit positions: 0, 1, 2, 3, 4, 5, 6...

Embedded Systems

Program microcontrollers, configure registers, set up interrupts, and control hardware components in IoT and automation projects.

PORT = 0b10101010; // Set pins
if (PIN & 0b00000001) // Read bit

Mathematical Foundations

Understanding the mathematical principles behind binary number systems

Base Systems Comparison

Decimal (Base-10)

Uses digits 0-9, place values are powers of 10

1234₁₀ = 1×10³ + 2×10² + 3×10¹ + 4×10⁰

Binary (Base-2)

Uses digits 0-1, place values are powers of 2

1010₂ = 1×2³ + 0×2² + 1×2¹ + 0×2⁰ = 10₁₀

Powers of Two

Understanding powers of 2 is crucial for binary arithmetic:

2⁰1
2
4
8
2⁴16
2⁵32
2⁶64
2⁷128

Binary Arithmetic Examples

Addition

101
+ 011
1000
5 + 3 = 8

Subtraction

111
- 010
101
7 - 2 = 5

Multiplication

11
× 10
110
3 × 2 = 6

Frequently Asked Questions

Why do computers use binary instead of decimal?

Computers use binary because digital circuits can easily represent two states: on (1) and off (0). This corresponds to high and low voltage levels in electronic components. Using more states would require more precise voltage levels, making circuits more complex, slower, and prone to errors.

What's the largest binary number this converter can handle?

Our converter can handle very large numbers, limited mainly by JavaScript's number precision (up to 2⁵³-1 or about 15-16 decimal digits). For most practical applications in programming, electronics, and computer science, this range is more than sufficient.

How do I convert negative numbers to binary?

For negative numbers, computers typically use "two's complement" representation. Our basic converter handles positive integers. For negative numbers in programming, the sign bit and two's complement arithmetic are used, which is a more advanced topic involving fixed-width binary representations.

Can I convert decimal fractions to binary?

Yes, decimal fractions can be converted to binary fractions. For example, 0.5 decimal equals 0.1 binary, and 0.25 equals 0.01 binary. However, many decimal fractions cannot be exactly represented in binary (like 0.1 decimal), which is why floating-point arithmetic can have precision issues.

What's the relationship between binary and hexadecimal?

Hexadecimal (base-16) is closely related to binary because 16 = 2⁴. Each hexadecimal digit represents exactly 4 binary digits (bits). This makes hex a convenient shorthand for binary: 1010₂ = A₁₆, 1111₂ = F₁₆. Programmers often use hex as a more readable way to represent binary data.

How accurate is this converter for educational purposes?

Our converter is completely accurate for educational use and follows standard binary-decimal conversion algorithms. It shows step-by-step breakdowns to help you understand the conversion process, making it perfect for learning computer science fundamentals, digital logic, and mathematical concepts.