🔄 Binary Complement Calculator
Visualize sign-magnitude, ones' complement and two's complement for integers with 8/16/32/64-bit widths, dec/bin/hex I/O, step-by-step derivation, color-coded bit grid and boundary presets
8-bit signed range: -128 to 127
Step-by-step Derivation
Results
Sign-magnitude原码
Ones' complement反码
Two's complement补码
Quick Reference
| Bits | Two's comp min | Max | Sign-mag min |
|---|---|---|---|
| 8 | -128 | 127 | -127 |
| 16 | -32768 | 32767 | -32767 |
| 32 | -2147483648 | 2147483647 | -2147483647 |
| 64 | -9223372036854775808 | 9223372036854775807 | -9223372036854775807 |
Sign-magnitude: MSB is the sign bit (0=positive, 1=negative), remaining bits are the absolute value in binary.
Ones' complement: Same as sign-magnitude for positive numbers; for negative numbers, flip all value bits.
Two's complement: Same as sign-magnitude for positive numbers; for negative numbers, ones' complement + 1. Modern computers universally use two's complement for signed integers.
Online sign-magnitude, ones' complement and two's complement calculator for 8/16/32/64-bit signed integers. Features decimal/binary/hex triple-format I/O, step-by-step derivation, color-coded bit grid (sign bit, flipped bits, carry bits), and MAX/MIN/-1/0 boundary presets. All computation runs locally in your browser — no server required.