Two's Complement Calculator

Two's complement is how a computer stores a negative whole number, by inverting the bits of the magnitude and adding one. Enter a decimal value and a width to get that pattern in binary and hexadecimal, or enter a binary or hex pattern to read it back as a signed value. Widths run from 4 to 64 bits, and every pattern is also shown as an unsigned number. A value too large for its width is not rejected; it wraps the way the hardware would, and the wrap is named.

Calculator Type

Enter a signed decimal value and a width to get the bit pattern a machine would store.

Negative values are allowed. A value too large for the width wraps, and the wrap is reported.
Widget

Enter a binary or hexadecimal pattern and read it back as a signed value.

Spaces, underscores and a leading 0b or 0x are ignored.
Widget