Signed Binary Calculator
Calculate signed binary addition, subtraction, multiplication and division using two’s-complement representation. Choose a bit width, enter positive or negative binary values, and view decimal equivalents, signed result, overflow status, numeric range and calculation details.
What Is a Signed Binary Calculator?
A signed binary calculator performs arithmetic on binary values that can represent both positive and negative numbers. This calculator uses fixed-width two’s-complement representation, the signed binary system commonly used by computer processors.
The most significant bit acts as part of the signed encoding. When the leading bit is zero, the represented value is nonnegative. When the leading bit is one, the same bit pattern is interpreted as a negative two’s-complement value.
The calculator supports signed binary addition, subtraction, multiplication and integer division while also checking whether the mathematical result exceeds the selected signed bit range.
How Signed Two’s-Complement Binary Works
Positive Values
Positive values use the same bit pattern as ordinary unsigned binary as long as the leading sign bit remains zero.
Negative Values
Negative values are represented modulo 2^n. For an n-bit word, the unsigned bit value is interpreted as signed by subtracting 2^n when the leading bit is one.
Signed Binary Range by Bit Width
| Bit Width | Minimum | Maximum | Range Formula |
|---|---|---|---|
| 4 bits | -8 | 7 | -2^3 to 2^3 – 1 |
| 8 bits | -128 | 127 | -2^7 to 2^7 – 1 |
| 12 bits | -2048 | 2047 | -2^11 to 2^11 – 1 |
| 16 bits | -32768 | 32767 | -2^15 to 2^15 – 1 |
| 24 bits | -8388608 | 8388607 | -2^23 to 2^23 – 1 |
Worked Example 1: Signed Binary Addition
Add -5 and +3 using 8-bit two’s complement.
Worked Example 2: Signed Binary Subtraction
Worked Example 3: Signed Binary Multiplication
Worked Example 4: Signed Binary Division
Signed Binary Overflow
Overflow occurs when the mathematical result lies outside the range available for the selected signed bit width.
Common Signed Overflow Examples
| Width | Calculation | Mathematical Result | Valid Range | Overflow? |
|---|---|---|---|---|
| 4 bit | 7 + 1 | 8 | -8 to 7 | Yes |
| 4 bit | -8 – 1 | -9 | -8 to 7 | Yes |
| 8 bit | 100 + 20 | 120 | -128 to 127 | No |
| 8 bit | 100 + 40 | 140 | -128 to 127 | Yes |
| 8 bit | -100 – 20 | -120 | -128 to 127 | No |
| 8 bit | -100 – 40 | -140 | -128 to 127 | Yes |
Signed vs Unsigned Binary
| Feature | Signed Binary | Unsigned Binary |
|---|---|---|
| Negative values | Supported | Not supported |
| 8-bit minimum | -128 | 0 |
| 8-bit maximum | 127 | 255 |
| Leading bit | Part of signed encoding | Ordinary highest-value bit |
| Common representation | Two’s complement | Standard positional binary |
Why the Same Bits Can Mean Different Values
A bit pattern has no signed or unsigned meaning by itself. The interpretation determines its numeric value.
| 8-bit Pattern | Unsigned Value | Signed Two’s-Complement Value |
|---|---|---|
| 00000101 | 5 | 5 |
| 01111111 | 127 | 127 |
| 10000000 | 128 | -128 |
| 11111110 | 254 | -2 |
| 11111111 | 255 | -1 |
Supported Signed Binary Operations
Addition
Adds the signed numeric values and reports whether the result remains within the selected bit range.
Subtraction
Subtracts the second signed operand from the first and returns the two’s-complement result.
Multiplication
Multiplies the decoded signed values. Multiplication can overflow quickly when the bit width is small.
Integer Division
Divides the first signed value by the second and truncates the quotient toward zero.
Important Signed Binary Notes
The same bit pattern can have a different numeric meaning when interpreted as unsigned binary.
When the mathematical result exceeds the chosen signed range, the calculator reports overflow and also displays the wrapped stored bit pattern.
Division is integer division and truncates the quotient toward zero. Division by zero is not allowed.