2’S COMP Signed Hex Decoder

Two’s Complement Hex Converter

Convert a fixed-width hexadecimal two’s-complement value into its signed decimal interpretation. Select the bit width to decode negative hex values and view the corresponding binary bit pattern, unsigned value and signed range.

Hex → Signed Decimal Two’s Complement 8 / 16 / 24 / 32 Bit Binary View Sign Bit
Two’s Complement Hex Decoder Fixed-Width Signed Integer
Enter hexadecimal digits. An optional 0x prefix is accepted.
Signed interpretation depends on the selected fixed width.
If MSB = 0: Signed Value = Unsigned Value

If MSB = 1: Signed Value = Unsigned Value – 2^N
The same hexadecimal digits can represent different signed values when interpreted at different widths. The selected bit width therefore matters and is never inferred silently.
Signed Two’s Complement Result
Signed Decimal Value
Hexadecimal
Unsigned Decimal
Signed Decimal
Bit Width
Sign Bit
Interpretation
Minimum Signed
Maximum Signed
Fixed-Width Binary
Conversion Calculation

What Is a Two’s Complement Hex Value?

Two’s complement is the most common representation for signed binary integers in modern digital systems. Because hexadecimal provides a compact representation of binary bits, signed machine values are frequently displayed as hexadecimal words such as FF, FFF6 or FFFFFFFF.

A hexadecimal value itself is simply a bit pattern. Whether it represents a positive or negative number depends on the selected word width and signed interpretation.

How the Two’s Complement Hex Converter Works

The converter first interprets the hexadecimal input as an unsigned binary value. It then checks the most-significant bit of the selected fixed-width word.

Sign bit = 0 → positive or zero

Sign bit = 1 → negative two’s-complement value

When the sign bit is one, the signed result is found by subtracting 2 raised to the selected bit width from the unsigned value.

Two’s Complement Hex Formula

For an N-bit hexadecimal word:

If unsigned value < 2^(N-1):
Signed = Unsigned

Otherwise:
Signed = Unsigned – 2^N

This provides a direct numerical conversion without manually flipping bits and adding one.

8-Bit Two’s Complement Hex Example

Consider hexadecimal F6 interpreted as an 8-bit signed integer.

Hex: F6

Binary: 11110110

Unsigned Decimal: 246

The first binary bit is 1, so the value is negative.

Signed = 246 – 2^8

= 246 – 256

= -10

16-Bit Two’s Complement Hex Example

Consider:

Hex: FFF6

Width: 16-bit

The unsigned hexadecimal value is 65526.

Signed = 65526 – 65536

= -10

The value therefore represents the same mathematical integer as 8-bit F6, but it uses a wider signed representation.

Why Bit Width Matters

Two’s-complement interpretation cannot be performed correctly without knowing the width of the signed word.

Hex FF as 8-bit: -1

Hex 00FF as 16-bit: 255

The hexadecimal digits may appear related, but the position of the sign bit changes with word width.

Two’s Complement Signed Ranges

Width Minimum Maximum Negative Sign Starts At
8-bit -128 127 0x80
16-bit -32,768 32,767 0x8000
24-bit -8,388,608 8,388,607 0x800000
32-bit -2,147,483,648 2,147,483,647 0x80000000

Hex FF as Two’s Complement

An 8-bit hexadecimal value FF corresponds to binary:

11111111

The unsigned value is 255, but as an 8-bit two’s-complement integer:

255 – 256 = -1

Therefore:

0xFF = -1 when interpreted as signed 8-bit

Hex 80 as Signed 8-Bit

Hexadecimal 80 is:

10000000

Its unsigned value is 128. As an 8-bit signed two’s-complement integer:

128 – 256 = -128

This is the minimum value representable by an 8-bit signed integer.

Hex 7F as Signed 8-Bit

Hexadecimal 7F converts to:

01111111

The sign bit is zero, so no subtraction is required.

0x7F = 127

This is the maximum signed 8-bit two’s-complement value.

Hex FFFFFFFF as Signed 32-Bit

A common value seen in registers, memory dumps and APIs is:

FFFFFFFF

As an unsigned 32-bit number it equals 4,294,967,295. As a signed 32-bit two’s-complement integer:

4,294,967,295 – 4,294,967,296 = -1

Hex 80000000 as Signed 32-Bit

The most negative signed 32-bit two’s-complement value is:

Hex: 80000000

Signed Decimal: -2,147,483,648

This asymmetry is a normal property of two’s complement: there is one more negative value than positive value.

Positive Two’s Complement Hex Values

Two’s-complement notation does not mean every hexadecimal value is negative. If the most-significant bit of the selected word is zero, the signed and unsigned decimal interpretations are identical.

Hex: 25

8-bit Binary: 00100101

Unsigned: 37

Signed: 37

Two’s Complement Hex in Embedded Systems

Embedded processors frequently store signed integers in two’s-complement form. Debuggers and register viewers often display those underlying bits as hexadecimal, so a negative reading may appear as a large hexadecimal value instead of an obvious negative decimal number.

Converting the fixed-width hex representation is useful when inspecting firmware variables, hardware registers, memory maps and device communication data.

Two’s Complement Hex in Sensor Registers

Many accelerometers, temperature sensors, gyroscopes, magnetic sensors and measurement devices return signed integers using two’s complement. Their raw registers may be displayed as hexadecimal bytes or words.

Sensor register: FFF6

16-bit signed interpretation: -10

Any sensor-specific scaling must be applied separately after decoding the signed integer.

Two’s Complement Hex in CAN and Modbus Data

Industrial and automotive data may contain fixed-width signed fields. After bytes are assembled in the correct byte order, the resulting hexadecimal word can require two’s-complement interpretation.

This converter assumes the hex word has already been assembled correctly. It does not change byte order or apply protocol-specific signal scaling.

Two’s Complement Hex vs Unsigned Hex

The underlying bits are identical; only their numerical interpretation changes.

Hex 8-Bit Unsigned 8-Bit Signed
00 0 0
01 1 1
7F 127 127
80 128 -128
FE 254 -2
FF 255 -1

Two’s Complement Hex Converter vs Binary Two’s Complement Tool

These tools begin from different user inputs and solve different practical tasks.

Tool Main Input Purpose
Two’s Complement Hex Converter Fixed-width hexadecimal word Decode signed hexadecimal machine data
Binary Two’s Complement Tool Binary value Work directly with two’s-complement binary bits

Why Leading Zeros Matter

Leading zeros can make the intended word width explicit.

FF as 8-bit = -1

00FF as 16-bit = 255

This calculator pads shorter inputs with leading zeros to the selected width but never allows a hexadecimal value that exceeds that width.

Important Two’s Complement Hex Notes

Important: signed interpretation depends on fixed bit width.

The calculator supports 8, 16, 24 and 32-bit values.

An optional 0x prefix is accepted.

Shorter hexadecimal input is padded with leading zeros to the selected width.

Input that exceeds the selected bit width is rejected rather than silently truncated.

If the most-significant bit is 0, signed value equals unsigned value.

If the most-significant bit is 1, signed value equals unsigned value minus 2^N.

This tool interprets an existing hexadecimal bit pattern. It does not change endianness, reorder bytes, apply sensor scaling or perform protocol decoding.

When decoding real registers or packets, confirm the correct field width and byte order from the relevant specification.

Two’s Complement Hex Converter FAQs

What does the Two’s Complement Hex Converter do?
It interprets a hexadecimal word as a fixed-width signed two’s-complement integer and returns its signed decimal and binary representations.
How do I convert two’s-complement hex to decimal?
Convert the hex word to an unsigned integer. If its sign bit is 1, subtract 2 raised to the selected bit width. If the sign bit is 0, keep the unsigned value.
What is 0xFF in 8-bit two’s complement?
0xFF is unsigned 255, but as an 8-bit signed two’s-complement value it represents -1.
What is 0xFE in 8-bit two’s complement?
0xFE is unsigned 254. Since the sign bit is set, 254 minus 256 equals -2.
What is 0x80 as a signed 8-bit value?
It represents -128, the minimum signed 8-bit two’s-complement integer.
What is 0x7F as a signed 8-bit value?
It represents +127, the maximum signed 8-bit value.
What is 0xFFFF as a signed 16-bit value?
0xFFFF represents -1 when interpreted as a signed 16-bit two’s-complement integer.
Why does bit width matter for two’s complement?
Bit width determines which bit is the sign bit and the value of 2^N used when converting a negative two’s-complement word.
Does this converter change byte order?
No. It interprets the hexadecimal word exactly as entered after padding it to the selected fixed width.
Can this decode signed sensor or register hex values?
Yes, if the complete word is already assembled in the correct byte order and the field uses standard two’s-complement signed integer encoding.
Scroll to Top