Two’s Complement Fixed Width Sign Bit Decoding 8–64 Bit Presets Custom Width
Fixed-Width Signed Hexadecimal Bit Pattern

Hex Two’s Complement to Binary Converter

Convert a raw hexadecimal bit pattern to its exact fixed-width binary representation and decode its two’s-complement signed value. Choose the bit width because values such as FF can represent -1 at 8 bits but +255 at 16 bits.

Exact width preserved MSB decoded as sign bit Signed decimal shown Optional 0x accepted
Two’s Complement Decoder
● LIVE
Enter raw hex without a minus sign · choose the exact signed storage width · the hex value must fit inside that width
FIXED-WIDTH BINARY TWO’S COMPLEMENT
11111111
Width: 8 bits Sign bit: 1 Interpretation: Negative
Signed decimal value: -1
TWO’S COMPLEMENT INTERPRETATION The leftmost bit at the selected width determines the sign
FF → 11111111 · MSB 1 → negative · 255 − 256 = -1
TRY:
Width Required 8, 16, 32, 64 or custom
Sign Rule MSB 1 = negative
8-bit FF 11111111 = -1
16-bit FF 0000000011111111 = 255
Output Width Preserved exactly

Hex Two’s Complement to Binary Converter

The Hex Two’s Complement to Binary Converter converts a raw hexadecimal bit pattern into binary using a specific signed integer width. It preserves exactly the selected number of bits and then interprets the leftmost bit according to two’s-complement rules.

Unlike ordinary unsigned hex conversion, width cannot be ignored. The same hexadecimal digits may represent either a positive or negative value depending on how many bits are used to store them.

Example: FF at 8 bits becomes 11111111 and represents -1. FF at 16 bits becomes 0000000011111111 and represents +255.

What Is Two’s Complement Hexadecimal?

Two’s complement is a fixed-width signed integer representation. Hexadecimal is often used as a compact way to display the underlying bits because one hexadecimal digit corresponds to four binary bits.

8-bit hexadecimal: FF Binary: 11111111 Two’s-complement interpretation: -1

The hexadecimal characters themselves are not inherently negative. Their signed meaning comes from the selected width and the resulting most significant bit.

Why Bit Width Is Required

A raw hex pattern needs a width before its two’s-complement signed meaning can be determined.

Hex Width Binary Signed Value
FF 8 11111111 -1
FF 16 0000000011111111 255
FF 32 00000000000000000000000011111111 255

Only the 8-bit version begins with a sign bit of 1.

How to Convert Two’s Complement Hex to Binary

First convert each hexadecimal digit to four binary bits. Then pad the result on the left with zeros until it reaches the selected width. Finally, inspect the leftmost bit.

Example: Hex = 80 Width = 8 8 → 1000 0 → 0000 Binary: 10000000 MSB = 1 Therefore signed interpretation is negative. Unsigned value = 128 2⁸ = 256 Signed: 128 − 256 = -128

Two’s Complement Signed Value Formula

Once the fixed-width binary pattern is known, a leading zero means the value is already non-negative. A leading one means the unsigned bit-pattern value must be reduced by 2 raised to the selected width.

If MSB = 0: signed value = unsigned value If MSB = 1: signed value = unsigned value − 2ⁿ where: n = bit width

8-Bit Two’s Complement Hex Examples

Hex 8-Bit Binary Signed Decimal
00 00000000 0
01 00000001 1
7E 01111110 126
7F 01111111 127
80 10000000 -128
81 10000001 -127
FE 11111110 -2
FF 11111111 -1

Example: Convert FF at 8 Bits

FF → 1111 1111 8-bit pattern: 11111111 MSB: 1 Unsigned value: 255 Signed value: 255 − 256 = -1

Example: Convert 80 at 8 Bits

80 → 1000 0000 Binary: 10000000 MSB: 1 Unsigned value: 128 128 − 256 = -128

This is the smallest value representable by an 8-bit two’s-complement integer.

Example: Convert 7F at 8 Bits

7F → 0111 1111 Binary: 01111111 MSB: 0 Signed value: 127

Because the sign bit is zero, no subtraction from 256 is performed.

16-Bit Two’s Complement Hex Examples

Hex 16-Bit Binary Signed Value
0000 0000000000000000 0
007F 0000000001111111 127
00FF 0000000011111111 255
7FFF 0111111111111111 32767
8000 1000000000000000 -32768
FFFE 1111111111111110 -2
FFFF 1111111111111111 -1

Example: FF at 8 Bits vs 16 Bits

This example demonstrates why width is part of the data interpretation, not just an output formatting choice.

FF at 8 bits: 11111111 MSB = 1 → -1 FF at 16 bits: 0000000011111111 MSB = 0 → 255

Two’s Complement Range by Width

An n-bit two’s-complement integer has an asymmetric range because one bit pattern is needed for the most negative value.

Width Minimum Maximum
8 bits -128 127
16 bits -32,768 32,767
32 bits -2,147,483,648 2,147,483,647
64 bits -9,223,372,036,854,775,808 9,223,372,036,854,775,807
General range: -2ⁿ⁻¹ through 2ⁿ⁻¹ − 1

Why Leading Zeros Must Be Preserved

Unlike an ordinary unsigned conversion, leading zeros can be essential in two’s-complement interpretation because they establish the chosen word width and sign position.

FF at 16 bits: 0000000011111111 Removing the leading zeros would produce: 11111111 But that would look like an 8-bit negative pattern. Therefore the 16-bit output remains: 0000000011111111

Why Leading Ones Also Matter

For negative fixed-width two’s-complement values, the leading one is the sign bit and forms part of the stored representation.

16-bit -1: FFFF → 1111111111111111

Removing leftmost bits would destroy the requested fixed-width representation.

Hex Two’s Complement vs Negative Hex

A negative hexadecimal number written with a minus sign and a two’s-complement hex bit pattern are two different representations.

Input Type Binary Meaning
-FF Explicit negative magnitude -11111111
FF at 8 bits Two’s complement 11111111 = -1
FF at 16 bits Two’s complement 0000000011111111 = 255

Why Minus Signs Are Not Used Here

Two’s-complement data encodes the sign inside the fixed-width bit pattern. Therefore the input should be the raw hexadecimal pattern rather than a mathematical value beginning with a minus sign.

Use FF with width 8 to decode the 8-bit two’s-complement pattern for -1. Do not enter -FF here.

Hex Value Must Fit the Selected Width

The numeric hexadecimal pattern cannot require more bits than the width selected by the user.

8-bit width allows: 00 through FF Therefore: FF → valid 100 → invalid at 8 bits

Hex 100 requires at least nine binary bits and therefore cannot be represented inside an 8-bit word.

Custom Two’s Complement Bit Width

The calculator includes 8, 16, 32 and 64-bit presets, but it also supports custom widths from 1 through 4096 bits.

The custom width does not have to be a multiple of four. If the supplied hexadecimal value fits within the selected number of bits, the calculator pads it to that exact width and interprets the resulting most significant bit as the sign bit.

12-bit example: FFF → 111111111111 → -1 12-bit: 800 → 100000000000 → -2048

Optional 0x Prefix

One optional 0x or 0X prefix is accepted before the hexadecimal bit pattern. The prefix identifies the base but does not contribute any bits.

0xFF at 8 bits → FF → 11111111 → -1

32-Bit Two’s Complement Examples

Hex Signed Meaning
00000000 0
00000001 1
7FFFFFFF 2,147,483,647
80000000 -2,147,483,648
FFFFFFFE -2
FFFFFFFF -1

64-Bit Two’s Complement Examples

The same interpretation rule applies at 64 bits. The first of the 64 bits determines whether the raw pattern falls in the positive or negative half of the signed range.

7FFFFFFFFFFFFFFF → maximum signed 64-bit positive value 8000000000000000 → minimum signed 64-bit negative value FFFFFFFFFFFFFFFF → -1

Common Uses of Two’s Complement Hexadecimal

  • Debugging signed machine integers.
  • Reading memory dumps.
  • Interpreting register values.
  • Embedded systems development.
  • Binary protocol analysis.
  • Reverse engineering raw numeric fields.
  • Inspecting signed 8, 16, 32 and 64-bit integers.
  • Understanding debugger hexadecimal output.
  • Decoding low-level hardware values.
  • Computer architecture education.

Common Two’s Complement Conversion Mistakes

  • Ignoring bit width when deciding whether a value is negative.
  • Treating every hex value beginning with 8–F as negative regardless of width.
  • Removing leading zeros from a fixed-width output.
  • Entering -FF instead of the raw FF bit pattern.
  • Interpreting unsigned FF and signed 8-bit FF as the same numerical value.
  • Trying to fit a hexadecimal value into a width that is too small.
  • Counting the 0x prefix as part of the bit pattern.
  • Reversing byte order even though no endian conversion was requested.

Hex Two’s Complement to Binary Converter FAQs

What is FF in 8-bit two’s complement binary?
FF converts to 11111111. At 8 bits this pattern represents signed decimal -1.
What is 80 in 8-bit two’s complement?
80 converts to 10000000 and represents -128, the minimum signed 8-bit integer.
What is 7F in 8-bit two’s complement?
7F converts to 01111111 and represents positive 127.
Why does FF mean -1 at 8 bits?
The 8-bit binary pattern is 11111111. Its unsigned value is 255, and two’s-complement interpretation gives 255 − 256 = -1.
Why does FF mean 255 at 16 bits?
At 16 bits the pattern becomes 0000000011111111. The most significant bit is zero, so it is positive 255.
Does two’s complement require a bit width?
Yes. The location of the sign bit and the value of 2ⁿ both depend on the chosen width.
Can I enter -FF?
No. This converter expects a raw fixed-width hexadecimal bit pattern such as FF. Explicit negative hexadecimal values are handled by the Negative Hex to Binary Converter.
Can I enter 0xFF?
Yes. One optional 0x or 0X prefix is accepted and removed before conversion.
Are leading zeros preserved?
Yes. Binary output is padded to exactly the selected bit width because those bits establish the fixed-width signed representation.
What happens if the hex number is too large for the selected width?
The converter reports an error instead of truncating high bits, because silently dropping bits would change the bit pattern and signed value.
Can I use a custom bit width?
Yes. Custom widths from 1 through 4096 bits are supported.
Does this converter reverse endian order?
No. Hexadecimal digit and byte order are preserved exactly. Endian conversion is handled by separate tools.

Convert Hex Two’s Complement to Binary

Enter the raw hexadecimal bit pattern, select its exact signed integer width, and choose Convert Two’s Complement. The calculator verifies that the value fits the requested width, pads the binary output to exactly that number of bits, reads the most significant bit as the sign bit and reports the corresponding signed two’s-complement decimal value.

Scroll to Top