Datatype Converter

Convert between binary, hex, and decimal. Choose bit width; values wrap modulo 2n.
Signed view uses two’s complement.
Bits (MSB → LSB)
Tips: You can type in any field. Inputs accept underscores/spaces and optional prefixes 0x, 0b. Values are clamped modulo 2ⁿ.

Binary, hexadecimal and decimal conversion

Convert an integer among binary, hexadecimal and decimal representations at a selected bit width. Signed mode interprets the highest bit using two’s-complement notation, which is common in processors and programming languages.

Formula and method

For an n-bit signed value with the top bit set, signed value = unsigned value − 2^n.

Worked example

At 8 bits, hexadecimal FF is unsigned 255 and signed −1.

How to interpret the result

Hexadecimal, binary, and decimal are different representations of the same fixed-width bit pattern. Signed mode changes how that pattern is interpreted; it does not change the bits. For example, eight set bits represent 255 unsigned and −1 in signed two's-complement notation.

Important limitations

  • Values outside the selected width are truncated to that width.
  • Use the bit toggles to inspect or change individual positions.

Common questions

What happens when a value is too large?

The converter keeps only the low-order bits that fit the selected width. This wraparound mirrors common fixed-width machine arithmetic but can hide an input error, so inspect the displayed bits.

Why does the signed value become negative?

In two's complement the highest bit carries negative weight. When that bit is set, subtracting 2 raised to the selected width gives the signed interpretation.

Related tools

Method and examples reviewed September 8, 2026.