Skip to content
uencoder

Hexadecimal

Hexadecimal (hex) is the base-16 numeral system, using 0-9 and A-F for 0-15; it is one of the most common radix notations in computing.

Purpose

It represents binary data more compactly and byte-aligned — each hex digit corresponds to exactly 4 binary bits — making values easier for humans to read and align with hardware and protocol fields.

Mechanism

Each hexadecimal digit corresponds to 4 binary bits (a nibble). Values expand by positional weight: N = d_n×16^n + ... + d_0×16^0. A byte's high and low nibbles each yield one hexadecimal character.

Use cases

  • Debug output of memory addresses and register values
  • Color values (#FF8800)
  • Network protocol fields
  • Machine code display for assembly

Examples

  • Input
    255
    Output
    FF

    255 = 15×16 + 15

Common errors

Using a leading 0x in JSON numbers (JSON has no hexadecimal literals)
Store hexadecimal as strings or use decimal numbers

Related terms

Related tools

References