⚡ Free Signed Binary Tool

Binary Two’s Complement Calculator

Calculate the two’s complement of any binary bit pattern instantly. BinaryCon preserves your exact bit width, flips every bit, adds 1, and shows the signed decimal interpretation of the resulting fixed-width two’s-complement value.

✓ Free ✓ No sign-up ✓ Bit width preserved ✓ Signed decimal result
~ +1
Two’s Complement
Ready
Fixed-width input
BIN
Enter only 0 and 1. Leading zeros are significant and preserved.
Try:
✓ Two’s Complement Result
11111011
Same-width two’s-complement bit pattern
Bit Width 8
Input Unsigned 5
Result Signed -5
Calculation:

What Is Two’s Complement?

Two’s complement is the most common method used to represent signed integers in modern binary computer systems. It provides one consistent representation for zero and allows addition and subtraction hardware to work naturally with both positive and negative integer values.

To find the two’s complement of a fixed-width binary bit pattern, first invert every bit to create the one’s complement and then add 1 to that inverted value while keeping the same width.

For example, take the 8-bit representation of positive decimal 5: 00000101. Flipping all bits gives 11111010. Adding 1 produces 11111011. Under 8-bit two’s-complement signed interpretation, that pattern represents decimal -5.

Step 1: Invert

Replace every 0 with 1 and every 1 with 0 to obtain the one’s complement.

Step 2: Add 1

Add binary 1 to the inverted value and keep only the original number of bits.

How to Use the Two’s Complement Calculator

Enter a fixed-width binary value

Type a value such as 00000101. Include all leading zeros required by the intended width.

Invert every bit

BinaryCon automatically forms the one’s complement by changing 0 to 1 and 1 to 0.

Add binary 1

The calculator adds 1 to the inverted bit pattern while preserving the original width.

Review the signed result

The tool displays the final two’s-complement bit pattern and interprets that result as a signed integer using the entered width.

Copy the result

Use the copied bit pattern for programming exercises, digital logic, signed binary work, or computer architecture calculations.

Two’s Complement Formula

The practical bitwise procedure is:

Two’s Complement = One’s Complement + 1 or equivalently, for an n-bit unsigned value x: Two’s-complement bit pattern = (2ⁿ – x) mod 2ⁿ

The modulo operation is important because the result must remain inside the selected n-bit width. Any carry beyond the most significant bit is discarded.

Worked Example: Two’s Complement of 00000101

The 8-bit binary pattern 00000101 represents unsigned decimal 5.

Step 1: Original 8-bit value 00000101 Step 2: Find the one’s complement 11111010 Step 3: Add 1 11111010
+ 00000001
= 11111011
Final result 00000101 → 11111011 Under 8-bit two’s-complement interpretation, 11111011 represents -5.

Another Example: Two’s Complement of 00001010

Original: 00001010 Invert every bit: 11110101 Add 1: 11110101 + 1 = 11110110 Therefore: 00001010 → 11110110 In 8-bit two’s-complement signed form, 11110110 = -10.

Why Bit Width Matters in Two’s Complement

Two’s-complement representation always depends on a fixed number of bits. The negative form of the same positive magnitude changes when the width changes.

Width +5 -5 in Two’s Complement
4-bit 0101 1011
8-bit 00000101 11111011
16-bit 0000000000000101 1111111111111011
Important: never remove leading zeros before a fixed-width two’s-complement calculation. The width determines the signed range and the exact negative representation.

Two’s Complement Signed Ranges

An n-bit two’s-complement signed integer can represent values from:

Minimum = -2ⁿ⁻¹
Maximum = 2ⁿ⁻¹ – 1

That produces the following common ranges:

Bit Width Minimum Signed Value Maximum Signed Value
4-bit-87
8-bit-128127
16-bit-32,76832,767
32-bit-2,147,483,6482,147,483,647
64-bit-9,223,372,036,854,775,8089,223,372,036,854,775,807

How to Read a Two’s Complement Binary Number

In a fixed-width two’s-complement signed value, the most significant bit indicates whether the number is non-negative or negative.

If the most significant bit is 0, the value is non-negative and can be interpreted like an ordinary binary integer.

If the most significant bit is 1, the value is negative. One convenient way to determine its magnitude is to take the two’s complement again.

Consider: 11111011 The leading bit is 1, so the 8-bit value is negative. Find its two’s complement: Invert: 00000100
Add 1: 00000101
Magnitude = 5, therefore: 11111011 = -5

Two’s Complement vs One’s Complement

Property One’s Complement Two’s Complement
Calculation Invert every bit Invert every bit and add 1
Signed zero Two representations One representation
Negative range Symmetric around zero except duplicate zero One extra negative value
Modern signed integers Rare Widely used

Two’s complement solves the duplicate-zero problem found in signed one’s complement and simplifies binary arithmetic, which is a major reason it is standard in modern general-purpose computing.

Why Does Two’s Complement Have Only One Zero?

For any width, the all-zero pattern represents zero: 00000000 in 8 bits.

Taking the two’s complement of zero produces zero again:

00000000
Invert → 11111111
Add 1 → 1 00000000
The carry beyond the 8-bit width is discarded: Result → 00000000

Therefore two’s complement has a single zero representation instead of separate positive and negative zeros.

The Special Minimum Negative Value

An n-bit two’s-complement system has one more negative value than positive value. In 8 bits, the range is -128 through +127.

The 8-bit pattern:

10000000 represents -128.

Interestingly, taking the two’s complement of this bit pattern produces 10000000 again within the same 8-bit width. This occurs because positive +128 cannot be represented in signed 8-bit two’s complement.

Edge case: the minimum negative value has no positive counterpart inside the same signed width.

8-Bit Two’s Complement Examples

Decimal 8-bit Two’s Complement
000000000
100000001
500000101
1000001010
12701111111
-111111111
-211111110
-511111011
-1011110110
-12710000001
-12810000000

Two’s Complement and Binary Addition

One of the major benefits of two’s complement is that ordinary fixed-width binary addition can be used for signed values as long as overflow rules are understood.

For example, in 8 bits:

Positive 5: 00000101 Negative 3: -3 = 11111101 Add: 00000101 + 11111101 ———— 1 00000010 Discard the carry beyond 8 bits: 00000010 = 2 Therefore, 5 + (-3) = 2.

Where Two’s Complement Is Used

CPU integer arithmetic

Signed integer values are commonly represented in two’s-complement form so addition and subtraction can share efficient hardware operations.

Programming

Understanding signed binary is useful for bitwise operations, integer limits, overflow, masks, debugging, and low-level programming.

Embedded systems

Fixed-width signed sensor values, registers, protocol fields, and binary data are frequently interpreted as two’s-complement integers.

Computer science education

Two’s complement is fundamental to learning signed integer representation, binary arithmetic, overflow, and computer architecture.

Common Two’s Complement Mistakes

Forgetting to add 1

Flipping every bit gives the one’s complement. Two’s complement requires one additional binary 1.

Ignoring bit width

The same magnitude has different negative bit patterns at 4, 8, 16, or 32 bits. Always use the specified width.

Keeping an extra carry bit

Two’s-complement operations stay within the fixed width. A carry beyond the most significant bit is discarded.

Reading every leading 1 as a positive binary value

In signed two’s-complement interpretation, a most significant bit of 1 indicates a negative value.

Related BinaryCon Tools

Continue working with signed binary, complements, bitwise logic, and number conversion using these related tools.

Binary Two’s Complement FAQs

How do you find the two’s complement of a binary number?

Keep the required bit width, invert every bit, then add binary 1. For example, with 8-bit 00000101, inversion gives 11111010 and adding 1 produces 11111011.

What is the two’s complement of 00000101?

Invert 00000101 to get 11111010. Add 1 to obtain 11111011. In 8-bit signed two’s-complement representation, this corresponds to decimal -5.

What is the two’s complement of 00001010?

Inverting 00001010 gives 11110101. Adding 1 gives 11110110, which represents -10 in signed 8-bit two’s-complement form.

What does 11111111 mean in 8-bit two’s complement?

The 8-bit two’s-complement pattern 11111111 represents -1. Taking its two’s complement gives 00000001, showing a magnitude of 1, while the leading 1 in the original signed pattern indicates the negative interpretation.

What does 10000000 mean in 8-bit two’s complement?

It represents -128, the minimum possible signed 8-bit value. The signed 8-bit range is -128 through +127, so there is no positive +128 value inside the same width.

What is the difference between one’s and two’s complement?

One’s complement flips every bit. Two’s complement flips every bit and then adds 1. Two’s complement has one zero representation and is the standard signed integer representation in modern general-purpose systems.

Why do I need to know the number of bits?

The bit width determines both the complement result and the signed range. For example, -5 is 1011 in 4-bit two’s complement and 11111011 in 8-bit two’s complement. The numerical meaning depends on the complete fixed-width pattern.

What is the range of an 8-bit two’s-complement integer?

Eight-bit two’s complement represents values from -128 through +127. The minimum is -2⁷ and the maximum is 2⁷ – 1.

Why is the two’s-complement range asymmetric?

With n bits there are 2ⁿ total patterns. Two’s complement assigns half the patterns to negative values and half to non-negative values, but zero belongs to the non-negative side. This produces one extra negative value: -2ⁿ⁻¹ through 2ⁿ⁻¹ – 1.

Why is two’s complement used instead of signed magnitude?

Two’s complement allows signed addition and subtraction to work naturally with ordinary fixed-width binary arithmetic, avoids separate positive and negative zero patterns, and simplifies many hardware operations compared with older signed representations.

Can I take the two’s complement of a negative binary pattern?

Yes. Applying the same fixed-width two’s-complement operation again normally recovers the opposite signed value. For example, 11111011 becomes 00000101, corresponding to -5 and +5 respectively in 8-bit signed interpretation. The minimum negative value is a special overflow edge case because its positive counterpart cannot fit in the same width.

Does the calculator preserve leading zeros?

Yes. Leading zeros define the selected bit width and are therefore significant. BinaryCon complements exactly the entered positions and returns a result with the same number of bits.

Can this calculator handle very long binary values?

Yes. The complement is performed directly on the binary string, and signed interpretation uses BigInt arithmetic. This avoids the normal floating-point precision limits that would affect very large integer bit patterns.

Is the leftmost bit always a sign bit?

Only when the bit pattern is explicitly being interpreted as a fixed-width signed two’s-complement integer. The same string can instead be interpreted as an unsigned binary value, in which case every bit contributes to a non-negative magnitude.

Calculate Two’s Complement Instantly

Use BinaryCon for fixed-width two’s-complement calculations, signed decimal interpretation, verified binary examples, and practical bitwise tools without registration.

Scroll to Top