Calculator

Binary Calculator | Hex to Binary, Decimal Converter

Free binary calculator with step-by-step solutions. Convert binary to decimal, hex to binary, octal conversion. Binary addition, subtraction, two's complement tool.

Binary Calculator – Binary to Decimal, Hex, Octal Converter with Steps

Calculate binary addition, subtraction, multiplication with this comprehensive binary calculator. Convert between binary, decimal, hexadecimal, and octal number systems instantly. Perform binary operations (add, subtract, multiply), convert hex to binary, binary to decimal with step-by-step solutions. Supports signed binary numbers, two's complement, binary coded decimal (BCD), ASCII conversion, and binary logarithm calculations. Perfect for computer science students, programmers, and digital electronics enthusiasts.

🔢 Binary Arithmetic Calculator

Add, subtract, multiply binary numbers

Enter binary digits (0 and 1)
Select arithmetic operation
Enter binary digits (0 and 1)

Binary Arithmetic Result

Result (Binary)
10001
Result (Decimal)
17

Step-by-Step Solution:

🔄 Binary Decimal Converter

Convert between binary and decimal

Select conversion direction
Binary or decimal number

Conversion Result

Input
10110101
Output
181

Conversion Steps:

🔷 Hexadecimal Binary Converter

Convert between hex and binary

Select conversion direction
Hex (0-9, A-F) or Binary

Hex-Binary Conversion

Binary
00101111
Hexadecimal
2F
Decimal
47

Conversion Method:

🔶 Octal Binary Converter

Convert between octal and binary

Select conversion direction
Octal (0-7) or Binary

Octal-Binary Conversion

Binary
101111
Octal
57
Decimal
47

Conversion Method:

⚙️ Advanced Binary Tools

Signed binary, complement, BCD converter

Select tool
Binary number or decimal
For signed/complement operations

Advanced Result

Result
11110110

Explanation:

Understanding Binary Number System

The binary number system (base-2) is a positional numeral system that uses only two digits: 0 and 1. It is the foundation of all digital computers and electronics. Each digit position represents a power of 2, making it fundamentally different from our everyday decimal (base-10) system. Binary is essential for computer science, digital logic, programming, and electronics engineering.

Binary to Decimal Conversion

Converting binary to decimal involves multiplying each binary digit by its positional value (power of 2) and summing the results.

Binary to Decimal Formula:

Decimal = Σ (digit × 2^position)

Where:

  • digit = Binary digit (0 or 1)
  • position = Position from right (starting at 0)
  • Σ = Sum of all terms

Example: Convert 10110101 (binary) to decimal

Step 1: Write positional values (right to left, starting from 0)

Position: 7 6 5 4 3 2 1 0

Binary: 1 0 1 1 0 1 0 1

Power: 2⁷ 2⁶ 2⁵ 2⁴ 2³ 2² 2¹ 2⁰

Step 2: Calculate each position

Position 0: 1 × 2⁰ = 1 × 1 = 1

Position 1: 0 × 2¹ = 0 × 2 = 0

Position 2: 1 × 2² = 1 × 4 = 4

Position 3: 0 × 2³ = 0 × 8 = 0

Position 4: 1 × 2⁴ = 1 × 16 = 16

Position 5: 1 × 2⁵ = 1 × 32 = 32

Position 6: 0 × 2⁶ = 0 × 64 = 0

Position 7: 1 × 2⁷ = 1 × 128 = 128

Step 3: Sum all values

128 + 0 + 32 + 16 + 0 + 4 + 0 + 1 = 181

Result: 10110101₂ = 181₁₀

Decimal to Binary Conversion

Converting decimal to binary uses the division-by-2 method (successive division) or subtraction method.

Decimal to Binary Formula (Division Method):

Divide by 2, record remainders (bottom to top)

Algorithm:

  • 1. Divide decimal number by 2
  • 2. Record remainder (0 or 1)
  • 3. Use quotient for next division
  • 4. Repeat until quotient = 0
  • 5. Read remainders bottom-to-top

Example: Convert 181 (decimal) to binary

Division Method:

181 ÷ 2 = 90 remainder 1 (LSB - least significant bit)

90 ÷ 2 = 45 remainder 0

45 ÷ 2 = 22 remainder 1

22 ÷ 2 = 11 remainder 0

11 ÷ 2 = 5 remainder 1

5 ÷ 2 = 2 remainder 1

2 ÷ 2 = 1 remainder 0

1 ÷ 2 = 0 remainder 1 (MSB - most significant bit)

Read from bottom to top: 10110101

Result: 181₁₀ = 10110101₂

Verification: 128 + 32 + 16 + 4 + 1 = 181 ✓

Binary Addition Calculator

Binary addition follows rules similar to decimal addition, but with only two digits (0 and 1). When sum exceeds 1, we carry to the next position.

Binary Addition Rules

  • 0 + 0 = 0 (no carry)
  • 0 + 1 = 1 (no carry)
  • 1 + 0 = 1 (no carry)
  • 1 + 1 = 10 (write 0, carry 1)
  • 1 + 1 + 1 (with carry) = 11 (write 1, carry 1)

Example: 1011 + 110

  1011 (11 in decimal)
+ 0110 (6 in decimal)
------

Step-by-step (right to left):

Position 0: 1 + 0 = 1

Position 1: 1 + 1 = 10 (write 0, carry 1)

Position 2: 0 + 1 + 1(carry) = 10 (write 0, carry 1)

Position 3: 1 + 0 + 1(carry) = 10 (write 0, carry 1)

Position 4: 1(carry) = 1

Result: 10001 (17 in decimal)

Verification: 11 + 6 = 17 ✓

Binary Subtraction Calculator

Binary subtraction can be performed using direct subtraction or two's complement addition (preferred in computers).

Binary Subtraction Rules (Direct Method)

  • 0 - 0 = 0
  • 1 - 0 = 1
  • 1 - 1 = 0
  • 0 - 1 = 1 (borrow 1) → 10 - 1 = 1

Example: 1011 - 110

  1011 (11 in decimal)
- 0110 (6 in decimal)
------

Step-by-step:

Position 0: 1 - 0 = 1

Position 1: 1 - 1 = 0

Position 2: 0 - 1 = need borrow → 10 - 1 = 1

Position 3: 1 - 0 - 1(borrowed) = 0

Result: 0101 = 101 (5 in decimal)

Verification: 11 - 6 = 5 ✓

Hexadecimal to Binary Conversion

Each hexadecimal digit converts to exactly 4 binary bits (nibble). This makes hex-binary conversion very straightforward.

Hex to Binary Mapping

HexBinary (4-bit)Decimal
000000
100011
200102
300113
401004
501015
601106
701117
810008
910019
A101010
B101111
C110012
D110113
E111014
F111115

Example: Convert 2F (hex) to binary

Step 1: Convert each hex digit separately

2 (hex) → 0010 (binary)

F (hex) → 1111 (binary)

Step 2: Concatenate the binary groups

Result: 2F₁₆ = 00101111₂ = 47₁₀

Octal to Binary Conversion

Each octal digit converts to exactly 3 binary bits. Octal is often used as shorthand for binary in computing.

Octal to Binary Mapping

OctalBinary (3-bit)Decimal
00000
10011
20102
30113
41004
51015
61106
71117

Example: Convert 57 (octal) to binary

Step 1: Convert each octal digit

5 (octal) → 101 (binary)

7 (octal) → 111 (binary)

Step 2: Concatenate

Result: 57₈ = 101111₂ = 47₁₀

Signed Binary Numbers

Signed binary numbers represent both positive and negative values using different methods:

Sign-Magnitude Representation

MSB (Most Significant Bit) = sign bit (0 = positive, 1 = negative). Remaining bits = magnitude.

Two's Complement (Most Common)

Standard method for signed integers in computers. Range: -2^(n-1) to 2^(n-1)-1 for n bits.

Two's Complement Steps:

  • 1. One's complement: Invert all bits (0→1, 1→0)
  • 2. Add 1 to the result

Example: -10 in 8-bit two's complement

Step 1: Convert +10 to binary

10₁₀ = 00001010₂

Step 2: One's complement (invert bits)

11110101

Step 3: Add 1

11110101 + 1 = 11110110

Result: -10₁₀ = 11110110₂ (8-bit two's complement)

Verification (convert back):

MSB = 1 → negative number

Invert: 00001001, Add 1: 00001010 = 10 → -10 ✓

Frequently Asked Questions

How do you calculate binary to decimal?
Multiply each binary digit by 2 raised to its position (counting from right, starting at 0), then sum all values. Formula: Σ(digit × 2^position). Example: 1011₂ = (1×2³)+(0×2²)+(1×2¹)+(1×2⁰) = 8+0+2+1 = 11₁₀. Position 0 (rightmost) = 1×1=1, Position 1 = 1×2=2, Position 2 = 0×4=0, Position 3 = 1×8=8. Total = 11. Each position represents a power of 2: ...2⁵(32), 2⁴(16), 2³(8), 2²(4), 2¹(2), 2⁰(1). Only add values where bit is 1.
How do you convert decimal to binary step by step?
Use division-by-2 method: 1) Divide decimal by 2, 2) Record remainder (0 or 1), 3) Use quotient for next division, 4) Repeat until quotient = 0, 5) Read remainders bottom-to-top. Example: 13₁₀ to binary: 13÷2=6 rem 1, 6÷2=3 rem 0, 3÷2=1 rem 1, 1÷2=0 rem 1. Reading bottom-to-top: 1101₂. Alternatively, subtract largest power of 2: 13-8=5 (1), 5-4=1 (1), 1-2=can't (0), 1-1=0 (1) → 1101. Verify: 8+4+0+1=13✓. For fractions, multiply fractional part by 2, record integer part, repeat with new fraction.
How to add binary numbers?
Follow rules: 0+0=0, 0+1=1, 1+0=1, 1+1=10 (write 0 carry 1), 1+1+1=11 (write 1 carry 1). Add right-to-left like decimal. Example: 1011+110: Align right: 1011+0110. Position 0: 1+0=1. Position 1: 1+1=0 carry 1. Position 2: 0+1+1(carry)=0 carry 1. Position 3: 1+0+1(carry)=0 carry 1. Position 4: 1(carry)=1. Result: 10001₂ (17₁₀). Verify: 11+6=17✓. Key: Carry propagates left. For multiple numbers, add first two, then add result to third, etc. Watch for overflow in fixed-width systems.
What is hexadecimal to binary conversion?
Each hex digit converts to exactly 4 binary bits (nibble). Hex digits: 0-9, A(10), B(11), C(12), D(13), E(14), F(15). Conversion: Replace each hex digit with its 4-bit binary equivalent. Example: A3F₁₆: A→1010, 3→0011, F→1111 = 101000111111₂. Reverse (binary to hex): Group binary into 4-bit chunks from right, pad left with zeros if needed. Example: 11010110₂ = 1101 0110 = D6₁₆. Common uses: Memory addresses, color codes (#FF00AA), assembly programming. Advantage: Compact representation (1 hex = 4 binary). Quick reference: 0=0000, 1=0001...8=1000, 9=1001, A=1010, B=1011, C=1100, D=1101, E=1110, F=1111.
What is two's complement binary?
Two's complement is standard method for representing signed integers in computers. Process: 1) One's complement (invert all bits: 0→1, 1→0), 2) Add 1. Range for n-bit: -2^(n-1) to 2^(n-1)-1. 8-bit range: -128 to +127. Example: -5 in 8-bit: +5 = 00000101, Invert = 11111010, Add 1 = 11111011 = -5. MSB indicates sign: 0=positive, 1=negative. Advantages: Single representation for zero, arithmetic works same for signed/unsigned, easy negation (two's complement). To decode: If MSB=1, take two's complement to find magnitude, add negative sign. Used in: All modern CPUs, programming languages (int, long types). Alternative: Sign-magnitude (less common).
How to convert binary to hexadecimal?
Group binary into 4-bit chunks from right to left, pad left with zeros if needed, convert each group to hex digit. Example: 11010110₂: Group: 1101 0110. Convert: 1101=D, 0110=6. Result: D6₁₆. Another: 10111₂: Pad left: 0001 0111. Convert: 0001=1, 0111=7. Result: 17₁₆. Quick conversion table: 0000=0, 0001=1, 0010=2, 0011=3, 0100=4, 0101=5, 0110=6, 0111=7, 1000=8, 1001=9, 1010=A, 1011=B, 1100=C, 1101=D, 1110=E, 1111=F. Benefits: Shorter representation (4x compression), easier to read/write than long binary strings, commonly used in: IP addresses, MAC addresses, color codes, memory dumps, low-level programming.
What is binary coded decimal (BCD)?
BCD represents each decimal digit (0-9) as 4-bit binary. Unlike pure binary, each decimal digit encoded separately. Example: 395₁₀ in BCD: 3=0011, 9=1001, 5=0101 → 001110010101 (BCD). Compare to pure binary: 395₁₀=110001011₂ (9 bits, different value). BCD uses only 0-9 codes (0000-1001), wastes codes 1010-1111. Types: Unpacked BCD (1 byte per digit), Packed BCD (2 digits per byte, used in calculators). Advantages: Easy decimal-binary conversion, no rounding errors, used in: financial applications, calculators, digital displays, legacy systems. Disadvantages: Inefficient storage (20% waste), arithmetic more complex. Modern use: Credit card processing, accounting systems, embedded displays where exact decimal representation critical.

Binary Number System Applications

Computer Science & Programming

  • Data Storage: All digital data stored as binary (files, images, videos)
  • Boolean Logic: True/False represented as 1/0
  • Bitwise Operations: AND, OR, XOR, NOT, bit shifts
  • Memory Addressing: RAM addresses in binary/hex
  • Network Protocols: IP addresses, subnet masks

Digital Electronics

  • Logic Gates: AND, OR, NOT, NAND, NOR gates operate on binary
  • Microprocessors: All CPU operations in binary
  • Digital Signals: High (1) and Low (0) voltage levels
  • Error Detection: Parity bits, checksums

Number System Comparison

SystemBaseDigitsExampleUse Case
Binary20, 11011₂ = 11₁₀Computer internal representation
Octal80-713₈ = 11₁₀Unix file permissions, legacy systems
Decimal100-911₁₀Human-readable numbers
Hexadecimal160-9, A-FB₁₆ = 11₁₀Memory addresses, color codes
Shares:

Related Posts