Hex, Binary, Decimal & ASCII Converter

Convert between hex, binary, decimal, octal and ASCII, with width-aware bit grids and endianness swapping.

Example: 255 as a 8-bit value is 0xFF, 255 unsigned, -1 signed, 0b11111111.

Check it against real silicon

Chiprun runs your firmware on an emulated microcontroller and hands back the UART output, so you can confirm these numbers rather than trusting them.

Chiprun docs

Formula

value mod 2^width, interpreted signed and unsigned

Worked example

255 as a 8-bit value is 0xFF, 255 unsigned, -1 signed, 0b11111111.

  1. unsigned = value mod 2^width

    unsigned = 255 mod 2^8

    unsigned = 255

  2. signed = unsigned − 2^width (when the top bit is set)

    signed = 255 − 256

    signed = -1

Frequently asked questions

What is 255 in binary?

11111111 — eight bits, all set. In hexadecimal that is 0xFF, which is why 255 is the largest value a single byte can hold as an unsigned number.

Why does the same value show as two different decimals?

Signedness. In two's complement the top bit indicates sign, so the byte 0xFF is 255 when read as unsigned and −1 when read as signed. The bits are identical; only the interpretation differs. Mismatched signedness across an interface is a very common bug.

What does byte-swapped mean?

It shows the value with its byte order reversed — big-endian read as little-endian, or vice versa. If a multi-byte register looks like garbage but its byte-swapped form looks sensible, you have an endianness mismatch rather than a data problem.

How do I convert hex to decimal by hand?

Multiply each digit by its place value, which is a power of 16. 0x1F is 1 × 16 + 15 = 31. Grouping hex into 4-bit nibbles is why it is used for register work: each hex digit maps to exactly four bits.

What happens if my number is too big for the width?

It gets truncated — the high bits are simply discarded, keeping the low ones. This tool shows the truncated result and warns you, because that is precisely what the hardware register will do with the value.

Related tools