Scientific Converters Precise unit conversions for science & engineering.

    Loading…

    Two’s Complement Calculator

    Two’s complement negates by inverting the bits and adding 1: −45 in 8 bits is 1101 0011.

    Convert:
    8-bit two’s complement

    1101 0011

    One’s complement
    1101 0010
    Sign-magnitude
    1010 1101
    Hex (two’s complement)
    0xD3
    Range of 8-bit two’s complement
    -128 to 127
    Step-by-step solution
    1. |-45| in binary = 00101101
    2. Invert the bits: 11010010
    3. Add 1: 11010011

    Two’s Complement Formula

    −x = invert(x) + 1

    n-bit range −2ⁿ⁻¹ … 2ⁿ⁻¹ − 1

    Worked Example

    −45 as an 8-bit number:

    1. |-45| in binary = 00101101
    2. Invert the bits: 11010010
    3. Add 1: 11010011

    Sign-magnitude: 1010 1101 · Hex (two’s complement): 0xD3 · Range of 8-bit two’s complement: -128 to 127

    GATE tip

    Sign extension copies the sign bit: 8-bit 1101 0011 becomes 16-bit 1111 1111 1101 0011 with the same value −45. GATE often tests this with hex like 0xD3 → 0xFFD3.

    More Digital Logic and Number Representation Calculators

    Frequently asked questions

    Why is two’s complement used instead of sign-magnitude?

    It has a single zero and the same adder works for signed and unsigned numbers, so subtraction is just addition of the complement.

    How do I detect overflow in two’s complement addition?

    Overflow occurs when two numbers of the same sign give a result of the other sign, i.e. when the carry into and out of the sign bit differ.

    Sources

    Last reviewed: . Factors are stored exactly and computed with 50-digit decimal arithmetic. See how we verify conversion factors.

    Cite this page

    APA

    Scientific Converters. (2026, October 15). Two’s Complement Calculator. Retrieved October 25, 2026, from https://scientificconverters.com/calculators/twos-complement-calculator/

    IEEE

    Scientific Converters, "Two’s Complement Calculator," scientificconverters.com. Accessed: Oct. 25, 2026. [Online]. Available: https://scientificconverters.com/calculators/twos-complement-calculator/

    Send feedback

    Found a wrong value, a missing unit or an idea? Tell us. We read every message.

    What is it about?

    We store your message, the page you were on and your email if given. See the privacy policy.