TFT

Binary Addition & Subtraction Calculator – Compute in Base 2

Add and subtract binary numbers with our free online binary arithmetic calculator. See step-by-step solutions with decimal verification for computer science and digital logic applications.

Examples:

Binary Arithmetic – Base 2 Addition and Subtraction

Binary arithmetic is the foundation of all computer calculations. Inside every processor, billions of transistors perform binary addition and subtraction billions of times per second. Understanding binary math helps you grasp how computers work at the lowest level – from simple calculators to AI systems.

Binary uses only two digits: 0 and 1. This matches perfectly with electronic circuits, where 0 represents "off" (no voltage) and 1 represents "on" (voltage present). Every number your computer handles – text, images, sound – ultimately becomes binary for processing.

Binary Addition Rules

Basic Addition Table

0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10 (write 0, carry 1)
1 + 1 + 1 = 11 (write 1, carry 1)

The key difference from decimal: when you reach 2, you write 0 and carry 1 to the next column. It's like decimal addition, but you carry much sooner.

Example: 1011 + 1101

¹ ¹ (carries)
1011
+ 1101
──────
11000
Column by column (right to left):
1 + 1 = 10 → write 0, carry 1
1 + 0 + 1 = 10 → write 0, carry 1
0 + 1 + 1 = 10 → write 0, carry 1
1 + 1 + 1 = 11 → write 11
Result: 11000₂ = 24₁₀

Binary Subtraction Rules

Basic Subtraction Table

0 - 0 = 0
1 - 0 = 1
1 - 1 = 0
0 - 1 = 1 (borrow 1 from left)

When subtracting 1 from 0, you borrow from the next column. The borrowed 1 becomes 10 in binary (which is 2 in decimal), so 10 - 1 = 1.

Example: 1101 - 1011

⁰¹⁰ (after borrowing)
1101
- 1011
──────
0010
Column by column (right to left):
1 - 1 = 0
0 - 1: borrow from left → 10 - 1 = 1
0 - 0 = 0 (was 1, lent to right)
1 - 1 = 0
Result: 0010₂ = 2₁₀

Worked Examples

Example 1: Simple Addition

Add 101₂ + 11₂ (5 + 3 in decimal)

¹¹
101
+ 11
────
1000
Verification: 5 + 3 = 8 ✓

Example 2: Addition with Multiple Carries

Add 1111₂ + 1₂ (15 + 1 in decimal)

¹¹¹¹
1111
+ 1
──────
10000
Verification: 15 + 1 = 16 ✓
This is like 9999 + 1 = 10000 in decimal

Example 3: Subtraction with Borrowing

Subtract 10000₂ - 1111₂ (16 - 15 in decimal)

⁰¹¹¹¹⁰
10000
- 1111
──────
1
Verification: 16 - 15 = 1 ✓
Requires borrowing across multiple columns

Example 4: Byte Addition

Add two 8-bit numbers: 11110000₂ + 00001111₂ (240 + 15)

¹¹¹¹
11110000
+ 00001111
─────────
100000000
Verification: 240 + 15 = 255 ✓
Result needs 9 bits (overflow for 8-bit storage)

Example 5: Negative Result

Subtract 1111₂ - 10000₂ (15 - 16 in decimal)

15 - 16 = -1
Result: -1₁₀ = -1₂
In computers, negative numbers use
two's complement representation
-1 in 8-bit two's complement: 11111111

Quick Fact

Gottfried Wilhelm Leibniz formalized binary arithmetic in 1703, seeing it as evidence of divine creation – 1 representing God and 0 representing nothingness. He had no idea his system would power every computer 300 years later. The first electronic computer to use binary was the Atanasoff-Berry Computer (ABC) in 1942.

Frequently Asked Questions

Why do computers use binary instead of decimal?

Binary maps perfectly to physical switches: on or off, high voltage or low voltage. Building a circuit with ten stable states (for decimal) would be far more complex and error-prone. Binary's simplicity enables the billions of transistors in modern chips to work reliably at gigahertz speeds.

How do I convert binary to decimal?

Multiply each bit by its place value (powers of 2) and add. For 1011: (1×8) + (0×4) + (1×2) + (1×1) = 8 + 0 + 2 + 1 = 11. Place values from right to left are 1, 2, 4, 8, 16, 32, 64, 128...

What happens when binary addition overflows?

In fixed-width storage (like 8-bit registers), overflow bits are discarded. 11111111 + 1 = 100000000, but stored as 00000000. This is called "wraparound." Programming languages handle this differently – some throw errors, others silently wrap.

How do computers handle negative binary numbers?

Most computers use "two's complement": flip all bits and add 1. For -5 in 8-bit: 5 is 00000101, flip to 11111010, add 1 to get 11111011. This lets the same addition circuit handle both positive and negative numbers.

Can binary represent fractions?

Yes, using a binary point (like a decimal point). Positions to the right are 1/2, 1/4, 1/8, etc. So 10.11₂ = 2 + 0.5 + 0.25 = 2.75₁₀. Computers use floating-point formats (like IEEE 754) for fractional numbers.

What's the largest number I can calculate here?

This calculator converts to JavaScript numbers internally, which safely handles integers up to 2^53 - 1 (about 9 quadrillion). That's roughly 53 binary digits. For larger numbers, you'd need arbitrary-precision binary arithmetic.

Other Free Tools

Two's Complement Calculator – Convert to Twos Complement

Convert any integer to its two's complement binary form or decode two's complement back to decimal with our free online calculator. Supports various bit widths.

Bitwise Operations Calculator – Compute AND OR XOR NOT Shifts

Perform bitwise AND, OR, XOR, NOT, left shift, and right shift operations on integers with our free online bitwise calculator. See binary representations alongside results.

Number Base Converter – Binary, Octal, Decimal, Hex Converter

Convert numbers between binary, octal, decimal, and hexadecimal bases instantly with our free online number base converter. Perfect for computer science students and programmers.

Truth Table Generator – Create Logic Truth Tables Online

Generate truth tables for any logical expression with our free online truth table generator. Supports AND, OR, NOT, XOR, NAND, NOR, and implication operators for any number of variables.

Boolean Expression Evaluator – Evaluate Logic Expressions Online

Evaluate any Boolean expression for given variable values with our free online Boolean expression evaluator. Supports all logical operators including AND, OR, NOT, XOR, and more.

Logic Gate Simulator – Simulate AND OR NOT Gates Online

Simulate any combination of digital logic gates with our free online logic gate simulator. Set input values and see real-time output for AND, OR, NOT, NAND, NOR, and XOR gates.

Data Storage Converter – Convert KB, MB, GB, TB Online

Convert between any digital storage unit with our free online data storage converter. Supports bytes, kilobytes, megabytes, gigabytes, terabytes, and petabytes instantly.

BODMAS / PEMDAS Calculator – Order of Operations Solver

Solve any math expression using the correct order of operations with our free BODMAS/PEMDAS calculator. Get step-by-step breakdowns to understand exactly how each expression is evaluated.