Hexadecimal Explained

Hexadecimal (hex for short) is a positional numeral system for representing a numeric value as base 16. For the most common convention, a digit is represented as "0" to "9" like for decimal and as a letter of the alphabet from "A" to "F" (either upper or lower case) for the digits with decimal value 10 to 15.

As typical computer hardware is binary in nature and that hex is power of 2, the hex representation is often used in computing as a dense representation of binary information. A hex digit represents 4 contiguous bits known as a nibble.[1] An 8-bit byte is two hex digits, such as .

Special notation is often used to indicate that a number is hex. In mathematics, a subscript is typically used to specify the base. For example, the decimal value would be expressed in hex as . In computer programming, various notations are used. In C and many related languages, the prefix 0x is used. For example, 0x{{hexadecimal|491|no}}.

Written representation

Common convention

Typically, a hex representation convention allows either lower or upper case letters and treats the letter the same regardless of its case.

Often when rendering non-textual data, a value stored in memory is displayed as a sequence of hex digits with spaces between values. For instance, in the following hex dump, each 8-bit byte is a 2-digit hex number, with spaces between them, while the 32-bit offset at the start is an 8-digit hex number.

00000000 57 69 6B 69 70 65 64 69 61 2C 20 74 68 65 20 66 00000010 72 65 65 20 65 6E 63 79 63 6C 6F 70 65 64 69 61 00000020 20 74 68 61 74 20 61 6E 79 6F 6E 65 20 63 61 6E00000030 20 65 64 69 74 2C 20 69 6E 63 6C 75 64 69 6E 6700000040 20 79 6F 75 20 28 61 6E 64 20 6D 65 29 21

Identification

There are several conventions for expressing that a number is represented as hex.

Notes and References

  1. News: The hexadecimal system . 2022-08-26 . Ionos Digital Guide . en . 2022-08-26 . https://web.archive.org/web/20220826084201/https://www.ionos.co.uk/digitalguide/server/know-how/hexadecimal-system/ . live .