Hex Number Inverter

Flips every bit of a hexadecimal number within its own digit width, the practical operation you reach for when computing a bitwise complement of a register value, mask, or numeric constant rather than studying it as a logic gate. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-26

Overview

Introduction

Flipping every bit of a value is one of the most common low-level operations in firmware, driver, and protocol work, usually to compute a mask's complement or invert a set of flag bits.

This tool takes a hexadecimal number and flips every one of its bits within its own digit width, giving you the inverted value instantly without doing the binary conversion by hand.

What Is Hex Number Inverter?

A converter that computes the bitwise complement of a hexadecimal number: every 1 bit becomes 0 and every 0 bit becomes 1, keeping the result the same digit width as the input.

It uses the same per-digit complement table as the Hex NOT Calculator (each hex digit maps to 15 minus itself), just presented for the numeric-inversion use case rather than the logic-gate one.

How Hex Number Inverter Works

Your input is validated as hex digits (an optional 0x prefix is stripped), and its length sets the bit width for the inversion, no extra digits are assumed.

Each digit is replaced with its 4-bit complement (0↔F, 1↔E, 2↔D, 3↔C, 4↔B, 5↔A, 6↔9, 7↔8) and the digits are reassembled in place to form the inverted value.

When To Use Hex Number Inverter

Use it to compute the complement of a bitmask, so you know which bits a mask does not set.

It's also handy for double-checking a manually-worked bit inversion when debugging register values, flag bytes, or checksum-adjacent computations.

Features

Advantages

  • Keeps the result's digit width identical to the input, so nothing is silently zero-extended or truncated.
  • Handles arbitrary-length hex values via BigInt arithmetic, not capped at 32 or 64 bits.
  • Instant and fully client-side, no data leaves your browser.

Limitations

  • Bit width is inferred purely from your input's digit count; pad with leading zeros first if you need a specific fixed width.
  • Performs a pure bitwise flip, not a two's-complement arithmetic negation; the two give different results for the same input.

Examples

Inverting a palindrome-like byte

Input

A5

Output

5A

A5 = 10100101 in binary; flipping every bit gives 01011010, written back as 5A.

Inverting a 16-bit constant

Input

1234

Output

EDCB

Each digit is complemented independently: 1→E, 2→D, 3→C, 4→B, giving EDCB.

Best Practices & Notes

Best Practices

  • Pad your input with leading zeros to match a specific register or field width before inverting, if the width you typed doesn't already match it.
  • Use this together with a bitwise AND/OR tool to actually apply the inverted mask to a real value, rather than stopping at the inversion alone.

Developer Notes

Shares its implementation directly with the Hex NOT Calculator (a per-digit 15-minus-digit lookup table); the two tools exist for differing framing and discoverability, not differing math.

Hex Number Inverter Use Cases

  • Computing the complement of a bitmask for firmware or driver code
  • Inverting a flag byte or register value while debugging low-level code
  • Cross-checking a manually-computed bit inversion

Common Mistakes

  • Assuming bit inversion and arithmetic negation (-x) produce the same result; they don't, except by coincidence for specific values.
  • Forgetting that the output width always matches the input's digit count, not a fixed 8/16/32/64-bit size.

Tips

  • If you're thinking of this as "the NOT gate" rather than "flip this number's bits," the Hex NOT Calculator covers the identical operation with that framing.
  • Combine with the Hex Endianness Swapper if you also need to reorder the inverted value's bytes for a specific wire format.

References

Frequently Asked Questions