What is Hexadecimal?

Hexadecimal (hex) is a base-16 number system that uses 16 symbols: digits 0–9 and letters A–F, where A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15. Hexadecimal is favoured in computing because each hex digit maps exactly to four binary digits (a nibble), making it a compact shorthand for binary values.

In hexadecimal, each digit position represents a power of 16. The value 0xFF equals 15×16 + 15 = 255 in decimal, and 11111111 in binary. This clean 4-bit-to-1-digit mapping means that an 8-bit byte (0–255) is always two hex digits, a 16-bit value is four digits, and a 32-bit value is eight digits — fixed-width representations that are much easier to read than long binary strings.

Hexadecimal values are conventionally prefixed with 0x (in C, Python, Go, JavaScript, and most other languages) or # (in CSS for colours). Uppercase A–F and lowercase a–f are equivalent and accepted by all parsers.

Common uses of hexadecimal in programming include: memory addresses and pointer values (0x7fff5fbff700), CSS colour codes (#FF6600 = rgb(255, 102, 0)), file format magic numbers (PDF files begin with 25 50 44 46 = %PDF), network addresses and subnet masks, cryptographic hash outputs (SHA-256 produces 64 hex chars), and binary data in debuggers and hex editors.

To convert between hex and other bases, you multiply each digit by its positional power of 16 and sum. For long values, tools like the Number Base Converter handle arbitrarily large integers without precision loss.

Octal (base-8) is another compact binary shorthand — each octal digit represents exactly three binary digits — most commonly seen in Unix file permissions (chmod 755).

See also

We use cookies to serve ads and measure traffic. Cookie policy · Privacy policy