Two’s Complement Converter

Encode signed decimal integers as fixed-width two’s-complement binary and hexadecimal values with range validation.

Choose a bit width and enter a signed integer.
Advertisement

About the Two’s Complement Converter

Two’s complement stores signed integers using a fixed width of bits. Negative values are represented by adding 2 to the power of the chosen bit width to the signed value.

Two's complement is a fixed-width way to represent signed integers in binary. This converter shows the signed value, bit pattern and hexadecimal form, with range limits determined by the selected bit width.

Diagram and example

The 8-bit pattern 11111011 represents negative five.1111101111111011₂ = −5 (signed 8-bit integer)Hexadecimal representation: FB
At 8 bits, −5 is 11111011₂, which is FB₁₆. The bit pattern FF₁₆ means signed −1 and unsigned 255.

Formula & method

n-bit signed range: −2^(n−1) through 2^(n−1) − 1

How to use

  1. Use the fields labelled: Signed decimal integer, Bit width. Enter valid values or choose required options, following the units and optional-field notes shown beside each field.
  2. Select Convert to run Two’s Complement Converter and display the result.
  3. Check the result and units, then compare the output with the formula or method notes before applying the result.

Important note

This is a fixed-width signed representation, not a binary magnitude with a minus sign. Values outside the selected signed range are rejected rather than wrapped.

This browser-based tool does not save your input to an account. Verify results before using them in critical engineering, programming, or other high-stakes work.

Frequently Asked Questions

Why does bit width matter?

The bit width determines both the signed range and the length of the result.

Can I use the result as an unsigned value?

Yes. The tool also displays the same bit pattern interpreted as an unsigned integer.

Does it silently wrap overflow?

No. It reports an error if the value falls outside the selected signed range.