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.
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.
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.
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.
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.
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
Example: Convert 80 at 8 Bits
This is the smallest value representable by an 8-bit two’s-complement integer.
Example: Convert 7F at 8 Bits
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.
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 |
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.
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.
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.
Hex Value Must Fit the Selected Width
The numeric hexadecimal pattern cannot require more bits than the width selected by the user.
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.
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.
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.
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?
What is 80 in 8-bit two’s complement?
What is 7F in 8-bit two’s complement?
Why does FF mean -1 at 8 bits?
Why does FF mean 255 at 16 bits?
Does two’s complement require a bit width?
Can I enter -FF?
Can I enter 0xFF?
Are leading zeros preserved?
What happens if the hex number is too large for the selected width?
Can I use a custom bit width?
Does this converter reverse endian order?
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.