See How Things Work

Hexadecimal notation

Unit
Representing Information
Part
1. Bits
Lesson
1.4

Hexadecimal, base sixteen, is the usual shorthand for bits: each of its digits stands for exactly four bits, so a byte is two digits. This lesson proves that correspondence, converts bit patterns to hexadecimal and back one digit at a time, explains the conventions for writing it, such as the prefix 0x and capital or small letters, and reads it where it appears: in dumps of memory, network addresses and character codes.

A shorthand for bits

Lesson 1.3 stored numbers as patterns of 8, 16, 32 or 64 bits. Patterns that long are hard to read, to compare and to copy: in 0000001111101000, the 16-bit pattern of 1,000, it is easy to lose count of the zeros. Writing the number in decimal is short, but it hides the bits: nobody sees at a glance which bits of 1,000 are 1. Octal and hexadecimal are easily converted to and from binary, and for that reason they are often used by computer programmers;⁠[1] together with base 2, they are among the most important bases in computer science.⁠[2]

Hexadecimal is base sixteen, as defined in Number Bases lesson 1.1. Its digits are 0 to 9 and then the letters A to F for the numbers 10 to 15.⁠[3] Informally, the word is shortened to hex.⁠[4]

Definition (Hexadecimal digit).

The sixteen hexadecimal digits are 0, 1, …, 9, A, B, C, D, E and F. The digits 0 to 9 stand for the numbers 0 to 9, and A, B, C, D, E and F for the numbers 10, 11, 12, 13, 14 and 15.⁠[3]

Sixteen is 2⁴, and that is the whole reason for its use: a hexadecimal digit and a group of four bits can take exactly the same sixteen values.

Theorem 1 (a hexadecimal digit is four bits).

The bit strings of length 4 name exactly the numbers 0 to 15, one each. So every hexadecimal digit corresponds to exactly one string of four bits, the 4-bit pattern of its value, and every string of four bits to exactly one hexadecimal digit.⁠[5]

Proof.

By the theorem “what k bits can name” of Number Bases lesson 1.2, with k = 4, the bit strings of length 4, zeros allowed on the left, name exactly the numbers 0 to 2⁴ − 1 = 15, and different strings name different numbers. The sixteen hexadecimal digits stand for the same numbers 0 to 15, one each. Pair each digit with the string that names its value: every digit then has exactly one string, and every string exactly one digit. This is a one-to-one correspondence (Counting lesson 1.1).

A group of four bits is a nibble (lesson 1.2). So one hexadecimal digit is one nibble, and a byte, which is two nibbles, is exactly two hexadecimal digits.⁠[6] Inside a nibble the bits are worth 8, 4, 2 and 1, from the left, and the value of the nibble is the value of its digit.

0
0000
0
1
0001
1
2
0010
2
3
0011
3
4
0100
4
5
0101
5
6
0110
6
7
0111
7
8
1000
8
9
1001
9
A
1010
10
B
1011
11
C
1100
12
D
1101
13
E
1110
14
F
1111
15
Table. The sixteen hexadecimal digits, each with the nibble that it stands for (green) and its value in decimal (below). The digits 8 to F, shaded, are exactly the nibbles whose leftmost bit, worth 8, is 1.
Example (Reading nibbles).

Which digits stand for the nibbles 1011, 0110 and 1111? Which nibble does the digit D stand for?

  1. 1011: the bits worth 8, 2 and 1 are 1, so its value is 8 + 2 + 1 = 11, the digit B.
  2. 0110: 4 + 2 = 6, the digit 6. 1111: 8 + 4 + 2 + 1 = 15, the digit F.
  3. D stands for 13, and 13 = 8 + 4 + 1: the bits worth 8, 4 and 1 are 1 and the bit worth 2 is 0, so D is 1101.

Answer: B, 6 and F; D is 1101. Check against the table: every nibble has exactly one digit.

Bit patterns in hexadecimal

Number Bases lesson 1.3 proved that cutting a binary numeral into blocks of four bits, from the right, gives its hexadecimal numeral. In a computer the bits come as a pattern of fixed width, and the common widths, 8, 16, 32 and 64, are multiples of four. Then nothing has to be added: the blocks are simply the nibbles, read from the left.

Theorem 2 (patterns of 4m bits).

Let m ≥ 1. Replace each nibble of a pattern of 4m bits, from the left, by its hexadecimal digit. The result is a string of exactly m hexadecimal digits that names the same number as the pattern. This gives a one-to-one correspondence between the patterns of 4m bits and the strings of m hexadecimal digits, zeros allowed on the left.

Proof.

Number the nibbles from 0 at the right: nibble j holds the bits of the places 4j + 3, 4j + 2, 4j + 1 and 4j. Let x be the number that the pattern names. If x = 0, every nibble is 0000 and every digit is 0, and the string 00…0 names 0. Otherwise the binary numeral of x is the pattern with its zeros on the left removed. Cut that numeral into blocks of four from the right, as in the theorem “blocks of bits” of Number Bases lesson 1.3, with zeros written on the left of the first block if it is short. Block j then holds the bits of the same places as nibble j, and the zeros written on the left are the zeros of the pattern at those places: every block is a nibble of the pattern. By that theorem the digits of the blocks form the hexadecimal numeral of x. The remaining nibbles further left are 0000, and their digits 0 are zeros on the left, which change no value (Number Bases lesson 1.1). So the m digits name x.

Different patterns differ in some nibble, so their strings differ in that digit; and every string of m digits comes from a pattern, the one made of the digits’ nibbles (Theorem 1). So the correspondence is one to one.

The count agrees, as it must. There are 2⁴ᵐ patterns of 4m bits, and 16ᵐ strings of m hexadecimal digits; 16ᵐ is a product of m factors 2⁴, that is of 4m factors 2, so the two numbers are equal. A pattern of n bits, with n a multiple of four, therefore takes n ÷ 4 hexadecimal digits.

WidthHex digitsFrom … to
8 bits20x00 … 0xFF
16 bits40x0000 … 0xFFFF
32 bits80x00000000 … 0xFFFFFFFF
64 bits160x0000000000000000 … 0xFFFFFFFFFFFFFFFF
Table. The common widths in hexadecimal. A pattern of n bits takes n ÷ 4 digits. The smallest pattern, all 0s, is written with 0s only; the largest, all 1s, is written with Fs only.

The conversions in both directions need no arithmetic at all:

  • Bits to hexadecimal: cut the pattern into nibbles from the left and replace each nibble by its digit.
  • Hexadecimal to bits: replace each digit by its four bits, always four, with the zeros on the left of the nibble written out.
high byte C3 = 195low byte 50 = 801100001101010000C3501100 0011 0101 0000 = 0xC350 = 50,000
Figure. The 16-bit pattern of 50,000 from lesson 1.3, cut into its four nibbles: 1100, 0011, 0101 and 0000 are the digits C, 3, 5 and 0, so the pattern is 0xC350. Each byte is two digits: the high byte is C3, which is 195, and the low byte 50, which is 80.
Example (A byte in hexadecimal).

Write the byte 01101001 in hexadecimal.

  1. The nibbles, from the left, are 0110 and 1001.
  2. 0110 = 4 + 2 = 6 and 1001 = 8 + 1 = 9.

Answer: 69 in hexadecimal. Check: 6 × 16 + 9 = 105, and 01101001 = 64 + 32 + 8 + 1 = 105. A two-digit hexadecimal numeral like 69 looks like a decimal one; the next section shows how the two are told apart.

Example (Sixteen bits, four digits).

Write the 16-bit pattern of 50,000, 1100001101010000, in hexadecimal, and find its two bytes.

  1. The nibbles are 1100, 0011, 0101 and 0000, that is 12, 3, 5 and 0: the digits C, 3, 5 and 0.
  2. The high byte is the first two digits, C3, and the low byte the last two, 50.

Answer: C350, with the bytes C3 and 50. Check: 12 × 4,096 + 3 × 256 + 5 × 16 + 0 = 49,152 + 768 + 80 = 50,000; and C3 is 12 × 16 + 3 = 195 and 50 is 5 × 16 = 80, the high and low bytes that lesson 1.3 found by dividing 50,000 by 256.

Example (A common mistake: dropping the zeros inside a nibble).

Someone turns the hexadecimal number 31 into bits by writing the binary numeral of each digit: 3 is 11 and 1 is 1, which gives 111. What went wrong?

  1. 111₂ = 7. But 31 in hexadecimal is 3 × 16 + 1 = 49.
  2. Each digit must give exactly four bits: 3 is 0011 and 1 is 0001.
  3. So the bits are 0011 0001 = 32 + 16 + 1 = 49.

Answer: 00110001. The zeros on the left of a nibble are needed inside a pattern, because they keep every other bit in its place; only zeros at the very left of the whole pattern can be dropped.

Example (The edge case: a width that is not a multiple of four).

A field of 6 bits holds 101101. Write it in hexadecimal. Does the hexadecimal show the width?

  1. Six bits are one and a half nibbles. Cut from the right, as in Number Bases lesson 1.3: 10 and 1101.
  2. Write two zeros on the left of the short block: 0010 and 1101, that is 2 and 13, the digits 2 and D.
  3. Check: 2 × 16 + 13 = 45, and 101101 = 32 + 8 + 4 + 1 = 45.

Answer: 2D. The first digit can only be 0, 1, 2 or 3, because only two bits of its nibble belong to the field, and nothing in “2D” says that the field has 6 bits rather than 8. When the width is not a multiple of four, it must be stated separately.

Game

Nibble by nibble

Round
1
Score
0
Streak
0

A field of 8 bits holds 0x41. Set its bits.

digit 1

8
4
2
1

digit 2

8
4
2
1

Above each bit: its place value inside its nibble.

Writing hexadecimal

A row of digits such as 10 means ten in decimal, sixteen in hexadecimal and two in binary, so a hexadecimal numeral must be marked. The Mathematics lessons write the base as a small lowered numeral, as in 2AF₁₆ (Number Bases lesson 1.1). Computing documents usually put 0x in front instead: Python, for example, shows where an object is stored in memory as a number with the prefix 0x, which means that the number is in hexadecimal.⁠[7] In the Python language a whole number can be written in binary, octal or hexadecimal with the prefixes 0b, 0o and 0x.⁠[8]

Convention.

From here on, this unit writes hexadecimal numbers with the prefix 0x: 0x2AF = 2AF₁₆ = 687. A number without a prefix or a lowered base is decimal.

Capital or small letters. The value of a digit does not depend on how its letter is written. Python reads the digits 10 to 15 as the letters A to F in either case,⁠[8] and in a web page’s colors the case of the letters does not matter: #00ff00 is the same as #00FF00.⁠[9] Documents nevertheless choose one form. The Unicode Standard writes its code numbers with the capital letters A to F,⁠[10] while the recommended text form of the Internet’s IPv6 addresses requires small letters,⁠[11] although the earlier definition of those addresses expressed no preference.⁠[12] This site uses capital letters, except where a format requires small ones.

Zeros on the left. They change no value, but in a fixed-width pattern they are often written to show the width: 1,000 in 16 bits is 0x03E8. The rules differ from one document to another. The Unicode Standard leaves leading zeros out unless the number would have fewer than four digits,⁠[10] and an IPv6 address may leave out the leading zeros of each of its parts.⁠[13]

Caution.

A hexadecimal numeral is read digit by digit: 0x10 is “one zero hex”, sixteen, not ten. A numeral such as 0x2025 contains no letter and looks exactly like a decimal number, so without its mark it cannot be told apart from one: 0x2025 is 8,229.

Example (A common mistake: a hexadecimal size read as decimal).

A manual says that a buffer holds 0x100 bytes. Someone reserves 100 bytes for it. How many bytes are missing?

  1. 0x100 is a 1 in place 2 of base sixteen, worth 16² = 256.
  2. 256 − 100 = 156.

Answer: 156 bytes are missing. 0x100 bytes are 256 bytes, and the prefix was the only sign of it.

Long numbers in groups. Long hexadecimal numbers are split into groups, as long decimal numbers are split by commas. An IPv6 address has 128 bits.⁠[14] Its usual text form is eight groups separated by colons, each group one to four hexadecimal digits giving one of the eight 16-bit pieces of the address.⁠[15] Addresses that begin with 2001:db8 are set aside for examples in documents.⁠[16]

Example (Counting the bits of an IPv6 address).

Write the example address 2001:db8:4b0:0:0:0:0:2f with all its leading zeros, count its hexadecimal digits, and give the bits of its third group.

  1. Each group stands for 16 bits, four digits: 2001:0db8:04b0:0000:0000:0000:0000:002f.
  2. Eight groups of four digits are 32 digits, and 32 × 4 = 128 bits, as an IPv6 address must have.
  3. The third group, 04b0, is the nibbles of 0, 4, b and 0: 0000 0100 1011 0000.

Answer: 32 hexadecimal digits for 128 bits; the third group is 0000010010110000. Written in bits, the address would need 128 symbols.

Looking ahead.

IPv6 has a further rule that shortens runs of zero groups. It belongs to the unit Software, Operating Systems & Networks, lesson “Addresses, routing and protocols”.

Where hexadecimal is used

Hexadecimal appears wherever people look at bytes directly. A copy or list of the contents of data stored in a computer, such as the bytes of a file or of a piece of memory, is called a dump.⁠[17] The standard command-line tools include one that dumps files in various formats,⁠[18] and it can write the position of the bytes, counted from the start of the input, in decimal, octal or hexadecimal.⁠[19] In its output, the first line of each block of bytes begins with the position of the block’s first byte.⁠[20] The figure below lays out sixteen bytes of memory in the same way, with addresses in place of positions.

address
+0
+1
+2
+3
+4
+5
+6
+7
0200
E8
03
00
00
50
C3
2A
FF
0208
00
01
FF
FF
10
27
3C
9A
Figure. Sixteen bytes of memory, at the addresses 0x0200 to 0x020F, as a dump in hexadecimal: each row starts with the address of its first byte, and the column heads +0 to +7 give each byte’s distance from it. The two marked pairs are 16-bit numbers stored in little-endian order (lesson 1.3). A schematic drawing.
Example (Reading a dump).

In the figure, which byte is at the address 0x020B? Which 16-bit numbers are stored, in little-endian order, at 0x0200–0x0201 and at 0x020C–0x020D?

  1. 0x020B = 0x0208 + 3: the row labeled 0208, column +3. It holds FF = 255.
  2. 0x0200 holds E8 and 0x0201 holds 03. Little-endian order stores the low byte first, so the number is 0x03E8 = 3 × 256 + 14 × 16 + 8 = 768 + 224 + 8 = 1,000.
  3. 0x020C holds 10 and 0x020D holds 27: the number is 0x2710 = 2 × 4,096 + 7 × 256 + 1 × 16 + 0 = 8,192 + 1,792 + 16 = 10,000.

Answer: 0xFF; 1,000 and 10,000. In hexadecimal, reversing the order of the bytes only means swapping the pairs of digits, E8 03 becoming 03E8.

Game

Find it in the dump

Round
1
Score
0
Streak
0

At which address is the outlined byte stored? Write the address in hexadecimal.

address
+0
+1
+2
+3
+4
+5
+6
+7
D940
82
A2
8A
DA
7D
EA
71
0E
D948
B5
D4
54
57
F4
68
36
43
D950
B6
CF
4F
44
8A
37
61
26
D958
7A
4D
09
D9
2D
07
A9
7A

Addresses and bytes in hexadecimal. A row’s label is the address of its first byte.

Character codes. The Unicode Standard gives every character a number, its code point, and writes a code point as U+ followed by four to six hexadecimal digits.⁠[10] Its numbers run from 0 to 0x10FFFF, 1,114,112 of them in all.⁠[21]

Example (The edge case: the last Unicode number).

Check that the numbers from 0 to 0x10FFFF are 1,114,112 in all, as the Unicode Standard says.

  1. The places of 0x10FFFF are worth 16⁵, 16⁴, 16³, 16², 16 and 1, and 16⁵ = 16 × 16 × 16 × 16 × 16 = 1,048,576.
  2. 0x10FFFF = 1 × 1,048,576 + 0 × 65,536 + 15 × 4,096 + 15 × 256 + 15 × 16 + 15 = 1,048,576 + 61,440 + 3,840 + 240 + 15 = 1,114,111.
  3. The numbers from 0 to 1,114,111 are 1,114,111 + 1 = 1,114,112, because the count starts at 0.

Answer: 1,114,112, in agreement with the standard. The largest number is one less than the count of numbers, a point that the next lesson studies in general.

Colors. A web page can give a color as # followed by hexadecimal digits;⁠[9] with six digits, the three pairs give the amounts of red, green and blue, each from 00, the least, to ff, which is 255, the most.⁠[22] So #FF8000 has red 0xFF = 255, green 0x80 = 128 and blue 0x00 = 0: one byte for each of the three colors.

Looking ahead.

How colors are made from red, green and blue is the subject of this unit’s lesson “Color as red, green and blue”, and the Unicode code numbers are those of “Unicode and UTF-8”. How many values a field of n bits can hold, and how many bits a given range needs, is the next lesson, “How many values n bits can hold”.

Exercises

Exercise .

Write in hexadecimal: (a) the byte 10100111; (b) the 16-bit pattern 0000111100001111; (c) the 16-bit pattern 1000000000000001.

▸ Show solution

(a) 1010 0111: A and 7, so 0xA7. Check: 10 × 16 + 7 = 167 = 128 + 32 + 4 + 2 + 1.

(b) 0000 1111 0000 1111: 0x0F0F.

(c) 1000 0000 0000 0001: 0x8001. Check: 8 × 4,096 + 1 = 32,769 = 2¹⁵ + 1.

Exercise .

Write as bit patterns: (a) the byte 0x5E; (b) the 16-bit 0xF00D; (c) the 12-bit 0x007.

▸ Show solution

(a) 5 = 0101 and E = 1110: 01011110.

(b) F = 1111, 0 = 0000, 0 = 0000, D = 1101: 1111000000001101.

(c) 0 = 0000, 0 = 0000, 7 = 0111: 000000000111. Without the two zero nibbles the pattern would have 3 bits, not 12.

Exercise .

Without converting to decimal, decide which is larger, 0x99 or 0xA0, and explain why the comparison works. Then check it.

▸ Show solution

0xA0 is larger: both have two digits, and the first digit A (10) is larger than 9. Indeed 0x99 = 9 × 16 + 9 = 153 and 0xA0 = 10 × 16 = 160.

In general, of two numerals of the same length in one base, the one with the larger first digit names the larger number: its first place alone is worth at least one more 16ᵐ⁻¹, while all the later places of the other numeral together are worth at most 16ᵐ⁻¹ − 1 (Number Bases lesson 1.1, Exercise 5). If the first digits agree, the next ones decide, and so on.

Exercise .

(a) What is 0xFFFF + 1, and does it fit in 16 bits? (b) What is the largest 32-bit pattern, in hexadecimal and in decimal?

▸ Show solution

(a) 0xFFFF + 1 = 0x10000: the four Fs become 0s and a 1 appears on the left, by the successor rule of Number Bases lesson 1.1. It has five digits, so it needs more than 16 bits: 0x10000 = 16⁴ = 65,536 = 2¹⁶.

(b) A 32-bit pattern is 8 digits, so the largest is 0xFFFFFFFF = 2³² − 1 = 4,294,967,295 (lesson 1.3, Exercise 5).

Exercise .

In the dump of Section 4, (a) which byte is at the address 0x0206? (b) Which 16-bit number do the bytes at 0x0204 and 0x0205 store in big-endian order, and which in little-endian order?

▸ Show solution

(a) 0x0206 = 0x0200 + 6: the first row, column +6, which holds 2A = 2 × 16 + 10 = 42.

(b) 0x0204 holds 50 and 0x0205 holds C3. Big-endian: the first byte is the high byte, 0x50C3 = 5 × 4,096 + 0 × 256 + 12 × 16 + 3 = 20,480 + 192 + 3 = 20,675. Little-endian: 0xC350 = 50,000, the number of the example “Sixteen bits, four digits”.

Exercise .

Prove that a number is even exactly when the last digit of its hexadecimal numeral is 0, 2, 4, 6, 8, A, C or E.

▸ Show solution

The last hexadecimal digit of a number is its low nibble (Theorem 2), and the last bit of the number is the last bit of that nibble. The number is even exactly when its last bit is 0 (lesson 1.3, Proposition 1), that is, when the value of the last digit is even: 0, 2, 4, 6, 8, A (10), C (12) or E (14).

For example, 0x3E8 = 1,000 ends in 8 and is even; 0x2D = 45 ends in D (13) and is odd.

Exercise .

Write the byte 11111111 in octal. Explain why octal digits fit bytes badly and hexadecimal digits fit them exactly.

▸ Show solution

Octal digits stand for blocks of three bits (Number Bases lesson 1.3). Eight bits cut from the right give the blocks 3, 3 and 2: three octal digits, of which the first can only be 0 to 3. 255 = 11 111 111 = 377₈.

So a byte is not a whole number of octal digits, and two neighboring bytes do not split into octal digits byte by byte: the digit that straddles the bytes mixes bits of both. Since 8 = 2 × 4, a byte is exactly two hexadecimal digits, and every byte of a longer pattern keeps its own two digits, as C3 and 50 in 0xC350.

Summary

  1. Hexadecimal is base sixteen, with the digits 0 to 9 and A to F for 10 to 15. Since 16 = 2⁴, the sixteen digits correspond one to one to the sixteen nibbles of four bits.
  2. A pattern of 4m bits is exactly m hexadecimal digits: replace each nibble, from the left, by its digit, or each digit by its four bits, zeros included. A byte is two digits; 16, 32 and 64 bits are 4, 8 and 16 digits.
  3. Hexadecimal numbers are marked, usually with the prefix 0x (0x2AF) or a lowered base (2AF₁₆). Capital and small letters have the same value; documents choose one form, and zeros on the left may be written to show the width.
  4. Hexadecimal is used wherever bytes are shown directly: dumps of memory and files, addresses, IPv6 addresses (eight groups of four digits), Unicode code numbers (U+ and four to six digits) and web colors.

Sources

  1. 1.
    John H. Conway and Richard K. Guy, The Book of Numbers (Copernicus (Springer), 1996).
    Chapter 1, “The Romance of Numbers”, section “Numbers in Other Bases”, p. 21 (the whole topic: pp. 21).
    “The octal (base 8) and hexadecimal (base 16) systems are easily convertible to the binary system and so are often used by computer programmers.”
    Used for: octal and hexadecimal are easily converted to and from binary, and so they are often used by computer programmers.
  2. 2.
    Kenneth H. Rosen, Discrete Mathematics and Its Applications (8th ed., McGraw-Hill, 2019).
    Chapter 4, “Number Theory and Cryptography”, section 4.2, “Integer Representations and Algorithms” (4.2.2, “Representations of Integers”: “Octal and Hexadecimal Expansions”), p. 261 (the whole topic: pp. 260–261).
    “Among the most important bases in computer science are base 2, base 8, and base 16.”
    Used for: bases 2, 8 and 16 are among the most important bases in computer science.
  3. 3.
    Kenneth H. Rosen, Discrete Mathematics and Its Applications (8th ed., McGraw-Hill, 2019).
    Chapter 4, “Number Theory and Cryptography”, section 4.2, “Integer Representations and Algorithms” (4.2.2, “Representations of Integers”: “Octal and Hexadecimal Expansions”), p. 261 (the whole topic: pp. 260–261).
    “Usually, the hexadecimal digits used are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F, where the letters A through F represent the digits corresponding to the numbers 10 through 15 (in decimal notation).”
    Used for: the hexadecimal digits are 0 to 9 and the letters A to F for the numbers 10 to 15 (the definition).
  4. 4.
    “hex”, Cambridge Dictionary, Cambridge University Press.
    Section “Meaning of hex in English (the adjective, marked informal)”. dictionary.cambridge.org/dictionary/english/hex · open at the quoted passage.
    “short for hexadecimal”
    Used for: informally, the word hexadecimal is shortened to hex.
  5. 5.
    Kenneth H. Rosen, Discrete Mathematics and Its Applications (8th ed., McGraw-Hill, 2019).
    Chapter 4, “Number Theory and Cryptography”, section 4.2, “Integer Representations and Algorithms” (4.2.2, “Representations of Integers”: “Octal and Hexadecimal Expansions”), p. 261 (the whole topic: pp. 260–261).
    “Each hexadecimal digit can be represented using four bits.”
    Used for: Theorem 1: each hexadecimal digit corresponds to a string of four bits.
  6. 6.
    Kenneth H. Rosen, Discrete Mathematics and Its Applications (8th ed., McGraw-Hill, 2019).
    Chapter 4, “Number Theory and Cryptography”, section 4.2, “Integer Representations and Algorithms” (4.2.2, “Representations of Integers”: “Octal and Hexadecimal Expansions”), p. 261 (the whole topic: pp. 260–261).
    “Bytes, which are bit strings of length eight, can be represented by two hexadecimal digits.”
    Used for: a byte is exactly two hexadecimal digits.
  7. 7.
    Allen Downey, Think Python: How to Think Like a Computer Scientist (2nd ed., version 2.4.1, Green Tea Press, Needham, Massachusetts, 2015).
    Chapter 15, “Classes and objects”, section 15.1, “Programmer-defined types”, p. 148 (the whole topic: pp. 147–148).
    “When you print an instance, Python tells you what class it belongs to and where it is stored in memory (the prefix 0x means that the following number is in hexadecimal).”
    Used for: Python shows where an object is stored in memory as a number with the prefix 0x, which means that the number is in hexadecimal.
  8. 8.
    “The Python Language Reference, 2. Lexical analysis”, Python 3 documentation, Python Software Foundation.
    Section “2.6.1, “Integer literals””. docs.python.org/3/reference/lexical_analysis.html · open at the quoted passage.
    “Integers can be specified in binary (base 2), octal (base 8), or hexadecimal (base 16) using the prefixes 0b, 0o and 0x, respectively. Hexadecimal digits 10 through 15 are represented by letters A-F, case-insensitive.”
    Used for: in Python, whole numbers can be written in binary, octal or hexadecimal with the prefixes 0b, 0o and 0x; the hexadecimal digits 10 to 15 are the letters A to F in either case.
  9. 9.
    Chris Lilley, Tab Atkins Jr. and Lea Verou (eds.), “CSS Color Module Level 4”, World Wide Web Consortium (W3C).
    Section “5.2, “The RGB Hexadecimal Notations: #RRGGBB””. w3.org/TR/css-color-4 · open at the quoted passage.
    “In other words, a hex color is written as a hash character, "#", followed by some number of digits 0-9 or letters a-f (the case of the letters doesn’t matter - #00ff00 is identical to #00FF00).”
    Used for: a web page’s color can be written as # followed by hexadecimal digits, and the case of the letters does not matter: #00ff00 is the same as #00FF00.
  10. 10.
    The Unicode Consortium, The Unicode Standard, Version 18.0: Core Specification (Unicode Consortium, South San Francisco, 2026).
    Chapter Appendix A, “Notational Conventions”, section A.1.1, “Code Points”, p. 1236 (the whole topic: pp. 1236).
    “In running text, an individual Unicode code point is expressed as U+n, where n is four to six hexadecimal digits, using the digits 0–9 and uppercase letters A–F (for 10 through 15, respectively). Leading zeros are omitted, unless the code point would have fewer than four hexadecimal digits”
    Used for: the Unicode Standard writes a code point as U+ followed by four to six hexadecimal digits, with the capital letters A to F, and leaves out leading zeros unless the number would have fewer than four digits.
  11. 11.
    S. Kawamura and M. Kawashima, “RFC 5952: A Recommendation for IPv6 Address Text Representation”, RFC Editor, Internet Engineering Task Force (August 2010).
    Section “4.3, “Lowercase””. rfc-editor.org/rfc/rfc5952.html · open at the quoted passage.
    “The characters "a", "b", "c", "d", "e", and "f" in an IPv6 address MUST be represented in lowercase.”
    Used for: the recommended text form of IPv6 addresses requires small letters.
  12. 12.
    S. Kawamura and M. Kawashima, “RFC 5952: A Recommendation for IPv6 Address Text Representation”, RFC Editor, Internet Engineering Task Force (August 2010).
    Section “2.3, “Uppercase or Lowercase””. rfc-editor.org/rfc/rfc5952.html · open at the quoted passage.
    “[RFC4291] does not mention any preference of uppercase or lowercase.”
    Used for: the earlier definition of IPv6 addresses (RFC 4291) expressed no preference between capital and small letters.
  13. 13.
    R. Hinden and S. Deering, “RFC 4291: IP Version 6 Addressing Architecture”, RFC Editor, Internet Engineering Task Force (February 2006).
    Section “2.2, “Text Representation of Addresses””. rfc-editor.org/rfc/rfc4291.html · open at the quoted passage.
    “Note that it is not necessary to write the leading zeros in an individual field, but there must be at least one numeral in every field”
    Used for: an IPv6 address may leave out the leading zeros of each of its parts.
  14. 14.
    R. Hinden and S. Deering, “RFC 4291: IP Version 6 Addressing Architecture”, RFC Editor, Internet Engineering Task Force (February 2006).
    Section “2, “IPv6 Addressing””. rfc-editor.org/rfc/rfc4291.html · open at the quoted passage.
    “IPv6 addresses are 128-bit identifiers for interfaces and sets of interfaces”
    Used for: an IPv6 address has 128 bits.
  15. 15.
    R. Hinden and S. Deering, “RFC 4291: IP Version 6 Addressing Architecture”, RFC Editor, Internet Engineering Task Force (February 2006).
    Section “2.2, “Text Representation of Addresses””. rfc-editor.org/rfc/rfc4291.html · open at the quoted passage.
    “The preferred form is x:x:x:x:x:x:x:x, where the 'x's are one to four hexadecimal digits of the eight 16-bit pieces of the address.”
    Used for: the usual text form of an IPv6 address is eight groups separated by colons, each one to four hexadecimal digits giving one of the eight 16-bit pieces.
  16. 16.
    G. Huston, A. Lord and P. Smith, “RFC 3849: IPv6 Address Prefix Reserved for Documentation”, RFC Editor, Internet Engineering Task Force (July 2004).
    “The document describes the use of the IPv6 address prefix 2001:DB8::/32 as a reserved prefix for use in documentation.”
    Used for: the addresses that begin with 2001:db8 (their first 32 bits, the prefix 2001:DB8::/32) are reserved for examples in documents.
  17. 17.
    “dump noun”, Oxford Advanced Learner’s Dictionary, Oxford University Press.
    “an act of copying data stored in a computer; a copy or list of the contents of this data”
    Used for: a copy or list of the contents of data stored in a computer is called a dump.
  18. 18.
    “od: dump files in various formats”, The Open Group Base Specifications Issue 8 (IEEE Std 1003.1-2024, POSIX) (2024).
    “od — dump files in various formats”
    Used for: the standard command-line tools (POSIX) include one, od, that dumps files in various formats.
  19. 19.
    “od: dump files in various formats”, The Open Group Base Specifications Issue 8 (IEEE Std 1003.1-2024, POSIX) (2024).
    “The characters 'd', 'o', and 'x' specify that the offset base shall be written in decimal, octal, or hexadecimal, respectively.”
    Used for: the tool can write the position (offset) of the bytes in decimal, octal or hexadecimal.
  20. 20.
    “od: dump files in various formats”, The Open Group Base Specifications Issue 8 (IEEE Std 1003.1-2024, POSIX) (2024).
    “the first output line produced for each input block shall be preceded by the input offset, cumulative across input files, of the next byte to be written.”
    Used for: in od’s output, the first line for each block of input begins with the offset of the next byte to be written, that is, the position of the block’s first byte, counted from the start of the input.
  21. 21.
    The Unicode Consortium, The Unicode Standard, Version 18.0: Core Specification (Unicode Consortium, South San Francisco, 2026).
    Chapter 2, “General Structure”, section 2.4, “Code Points and Characters”, p. 65 (the whole topic: pp. 65–66).
    “In the Unicode Standard, the codespace consists of the integers from 0 to 10FFFF₁₆, comprising 1,114,112 code points available for assigning the repertoire of abstract characters.”
    Used for: the Unicode numbers (code points) run from 0 to 0x10FFFF, 1,114,112 of them in all.
  22. 22.
    Chris Lilley, Tab Atkins Jr. and Lea Verou (eds.), “CSS Color Module Level 4”, World Wide Web Consortium (W3C).
    Section “5.2, “The RGB Hexadecimal Notations: #RRGGBB””. w3.org/TR/css-color-4 · open at the quoted passage.
    “The first pair of digits, interpreted as a hexadecimal number, specifies the red component of the color, where 00 represents the minimum value and ff (255 in decimal) represents the maximum. The next pair of digits, interpreted in the same way, specifies the green component, and the last pair specifies the blue.”
    Used for: with six digits, the first pair gives the red component, from 00 (the least) to ff (255, the most); the next pair gives green and the last blue, in the same way.