Lesson Objective
- Understand how hexadecimal numbers can be used to represent denary and binary numbers.
- Explain the need for hexadecimal numbers.
KS3, GCSE, A-Level Computing Resources
Hexadecimal (or hex) is a base 16 system used to simplify how binary is represented. A hex digit can be any of the following 16 digits: 0 1 2 3 4 5 6 7 8 9 A B C D E F.
Each hex digit reflects a 4-bit binary sequence.
By using hexadecimal, an 8-bit binary number can be written using only two different digits - one hex digit for each nibble (or group of 4-bits). It is much easier to write numbers as hex than to write them as binary numbers. For example:
Binary, Denary, Hex:
Binary | Decimal | Hexadecimal |
---|---|---|
0000 | 0 | 0 |
0001 | 1 | 1 |
0010 | 2 | 2 |
0011 | 3 | 3 |
0100 | 4 | 4 |
0101 | 5 | 5 |
0110 | 6 | 6 |
0111 | 7 | 7 |
1000 | 8 | 8 |
1001 | 9 | 9 |
1010 | 10 | A |
1011 | 11 | B |
1100 | 12 | C |
1101 | 13 | D |
1110 | 14 | E |
1111 | 15 | F |
Example 1.
Example 2.
Compact Representation of Binary Data
Hexadecimal simplifies the representation of large binary numbers using fewer digits. It is commonly used for memory addresses, machine code instructions, and other hardware-related values in computing .
Color Representation
In graphics and web design, colors are often specified using hexadecimal notation. Each color component (red, green, and blue) is represented by a two-digit hexadecimal value (ranging from 00 to FF). For example, #FF0000 corresponds to pure red. Hexadecimal makes it easier to define and manipulate colors .
MAC Addresses
Media Access Control (MAC) addresses, which uniquely identify network devices, are typically written in hexadecimal. These addresses play a crucial role in networking and communication between devices. Here is an example of a MAC Address - 4A:32:BE:5D:A4:4F. The MAC address is usually 48 bits long
Debugging and Error Messages
When debugging software, hexadecimal values are commonly used to inspect memory dumps, analyze program execution, and diagnose issues. Hexadecimal provides a more human-readable format for examining binary data.
IP Addresses
Although decimal notation is more common for IP addresses, hexadecimal representation is occasionally used for both IPv4 and IPv6 addresses in specific contexts.
Hexadecimal simplifies binary data representation, aids in color coding, and is essential in various aspects of computer science and programming.