Skip to content
Hex Calculator

Negative Decimal to Hex Converter

Convert a negative decimal number into its two's-complement hex pattern at a chosen bit width — the encoding most systems use for signed integers.

Hexadecimal result
0xF6
Bit width

Full breakdown (result at 8-bit)

Hexadecimal
0xF6
Decimal (unsigned)
246
Binary
11110110
Octal
366
Signed (8-bit)
-10
Set / clear bits
6 set, 2 clear

How to Convert a Negative Decimal Number to Hex

Start with the number's magnitude — ignore the minus sign for a moment — and convert that to hex the normal way. Then, at your chosen bit width, invert every bit and add 1. That's the two's-complement encoding used to represent the negative value.

The bit width has to be fixed ahead of time, since inverting bits only makes sense across a specific number of them — the same magnitude produces a different final pattern at 8-bit versus 32-bit.

Where This Conversion Actually Comes Up

Writing a Signed Value to a Register

Embedded and firmware code often needs to write a negative calibration offset or sensor adjustment into a register that only accepts hex — this is the step that turns -10 into the F6 the register expects.

-10 -> 0xF6 (8-bit)

Encoding a Negative Offset in a File Format

Binary formats that store relative jumps, deltas, or offsets as signed integers need those values two's-complement-encoded before they go into the file's raw bytes.

-1000 -> 0xFC18 (16-bit)

Debugging a Signed Variable's Raw Bytes

When a debugger shows you a variable's hex memory contents, converting the signed decimal value you expect into hex first lets you confirm the bytes match what your code should have stored.

-1 -> 0xFF (8-bit)

Negative Decimal to Hex Example, Step by Step

-10 (8-bit) = F6

-10, as an 8-bit signed value = 0xF6

Magnitude: 10 = 0000 1010

Invert:    1111 0101
+1:        1111 0110 = F6
StepDescriptionResult
Convert the magnitude10 (decimal) = 0000 1010 (8-bit)0A
Invert all bits0000 1010 inverted is 1111 0101F5
Add 1F5 + 1 = F6F6

Checking the sign bit of F6 (1111 0110) confirms it's set, so reading it back as signed 8-bit correctly gives -10 again.

Common Mistakes When Converting Negative Decimal to Hex

  • Converting the magnitude to hex, but forgetting the invert-and-add-1 steps entirely.
  • Choosing a bit width too narrow for the number — -200 doesn't fit in a signed 8-bit value (range is -128 to 127).
  • Adding 1 before inverting the bits, instead of after.
  • Mixing up this method with simply writing a minus sign in front of the plain hex value, which isn't how two's complement works.

Why Use This Calculator Instead of Doing It by Hand

  • Handles the invert-and-add-1 steps for you, so there's no manual bit flipping
  • Validates your number against the selected bit width's actual signed range
  • Runs entirely in your browser — nothing you type gets sent anywhere
  • Lets you switch bit widths instantly to see how the same value encodes differently

Frequently Asked Questions

How do you convert a negative decimal number to hex?

Convert its magnitude (the number without the minus sign) to hex normally, invert every bit at your chosen bit width, then add 1. That result is the two's-complement hex representation of the negative value.

Why does the bit width matter for negative numbers?

Two's complement is only meaningful at a fixed width — the same negative number produces a different bit pattern at 8-bit versus 16-bit, since inverting and adding 1 happens across however many bits you've chosen.

What's the smallest negative number a given bit width can hold?

Exactly negative half the unsigned range: -128 for 8-bit, -32768 for 16-bit, and so on — one more than the largest positive value that width can hold, since zero only counts once.

Can I convert a positive number with this tool too?

Yes — enter it without a minus sign and it converts the same way regular decimal-to-hex does, just validated against the signed range for your chosen bit width instead of the unsigned range.

Is this the reverse of Hex to Negative Decimal?

Yes — that page reads an existing hex bit pattern as a signed number; this page starts from the signed number and produces the bit pattern.

What happens if my number doesn't fit the selected bit width?

The calculator flags it as out of range — pick a wider bit width so the value's magnitude fits within what that width can represent as a signed integer.

Is this the same as converting a signed decimal to hex?

Yes — "negative decimal to hex" and "signed decimal to hex" describe the same conversion. Positive signed values convert the same way plain decimal-to-hex does; this tool just also handles the negative side correctly.

Why can't I just put a minus sign in front of the hex digits?

Because that's not how any real system stores signed values in memory — hardware and file formats use two's complement, so -10 has to become F6 (at 8-bit), not "-A". A literal minus sign in front of hex digits isn't valid in binary data.