Hexadecimal
Binary numbers get long fast. The 8-bit value 11010110 is easy to misread — any individual digit could be a 1 or a 0 and a single transcription error changes the meaning completely. When engineers and programmers need to work with binary data, they use hexadecimal (base 16) as a compact shorthand that maps perfectly onto binary without any information loss.
Hexadecimal appears everywhere in radio work. Open a firmware hex file, read a transceiver service manual's memory map, or look at the output of a digital mode decoder — you will see hex. Understanding it turns opaque strings like 0x1A3F and 0xFF into meaningful numbers.
Each hexadecimal digit corresponds to exactly four binary bits. Memorizing this table makes binary-to-hex conversion instantaneous.
View LargerWhy Hexadecimal Exists
When you store data in a digital system, it is stored as binary — groups of bits. The most common grouping is the byte (8 bits). An 8-bit byte can hold 256 different values (28 = 256), from 00000000 to 11111111.
Writing bytes in binary is impractical. A 4-byte memory address like 11111111111111110000000000000000 is almost impossible to read correctly. Writing it in decimal (4,294,901,760) loses all visual connection to the underlying bit pattern — you cannot see at a glance which bits are set. What is needed is a notation that is short, unambiguous, and directly reveals the binary content.
Hexadecimal provides exactly this. Because 16 = 24, each hexadecimal digit represents exactly four binary bits. This means 8 bits (one byte) fit neatly into two hex digits, 16 bits into four, 32 bits into eight. The binary address 11111111111111110000000000000000 becomes FFFF0000 in hex — compact, unambiguous, and easy to verify against a bit pattern.
The 16 Hexadecimal Digits
Decimal uses ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. Hexadecimal needs 16 symbols. It uses the decimal digits 0–9 for values zero through nine, then the letters A, B, C, D, E, F for values ten through fifteen:
| Hex | Decimal | Binary (4-bit) |
|---|---|---|
| 0 | 0 | 0000 |
| 1 | 1 | 0001 |
| 2 | 2 | 0010 |
| 3 | 3 | 0011 |
| 4 | 4 | 0100 |
| 5 | 5 | 0101 |
| 6 | 6 | 0110 |
| 7 | 7 | 0111 |
| 8 | 8 | 1000 |
| 9 | 9 | 1001 |
| A | 10 | 1010 |
| B | 11 | 1011 |
| C | 12 | 1100 |
| D | 13 | 1101 |
| E | 14 | 1110 |
| F | 15 | 1111 |
The letters A through F may be written in upper or lower case (a through f) — both are correct. The table above is worth memorizing. Once you know that F = 15 = 1111 and 8 = 1000, you can convert hex to binary by inspection without any calculation.
Converting Hex to Decimal
Hexadecimal is positional notation with a base of 16. The rightmost digit has a weight of 160 = 1, the next has a weight of 161 = 16, then 162 = 256, then 163 = 4,096, and so on.
To convert: multiply each digit's decimal value by its positional weight, then sum the results.
- 3 × 161 = 3 × 16 = 48
- A × 160 = 10 × 1 = 10
Total: 48 + 10 = 58 decimal
- 1 × 163 = 1 × 4,096 = 4,096
- A × 162 = 10 × 256 = 2,560
- 3 × 161 = 3 × 16 = 48
- F × 160 = 15 × 1 = 15
Total: 4,096 + 2,560 + 48 + 15 = 6,719 decimal
- F × 16 = 15 × 16 = 240
- F × 1 = 15 × 1 = 15
Total: 240 + 15 = 255 decimal — the maximum value of one byte.
Converting Decimal to Hex
The method mirrors decimal-to-binary conversion: repeatedly divide by 16 and record the remainders. Read the remainders from bottom to top. Any remainder from 10 to 15 is written as the letter A to F.
- 255 ÷ 16 = 15, remainder 15 = F
- 15 ÷ 16 = 0, remainder 15 = F
Reading bottom to top: FF hex
- 2,748 ÷ 16 = 171, remainder 12 = C
- 171 ÷ 16 = 10, remainder 11 = B
- 10 ÷ 16 = 0, remainder 10 = A
Reading bottom to top: ABC hex
Verify: (10 × 256) + (11 × 16) + (12 × 1) = 2,560 + 176 + 12 = 2,748 ✓
Hex and Binary: The Natural Fit
The most useful property of hexadecimal is the perfect correspondence between hex digits and 4-bit groups. Since 16 = 24, one hex digit represents exactly four bits. This means you can convert between hex and binary by working one digit at a time, with no carry calculations needed.
Binary to Hex
Group the binary number into 4-bit nibbles from the right (padding with leading zeros if necessary). Replace each nibble with its hex digit.
Group from right: 1011 0111 0001
- 1011 = B
- 0111 = 7
- 0001 = 1
Result: B71 hex
Verify: B71 = (11 × 256) + (7 × 16) + 1 = 2,816 + 112 + 1 = 2,929. Binary check: 2048+512+256+64+32+16+1 = 2,929 ✓
Hex to Binary
Replace each hex digit with its 4-bit binary equivalent. The result is the complete binary number with no further calculation needed.
- 9 = 1001
- E = 1110
Result: 10011110 binary
Verify: 128 + 16 + 8 + 4 + 2 = 158 decimal. 9E = 9×16 + 14 = 144 + 14 = 158 ✓
This one-nibble-per-digit relationship is why engineers universally prefer hex over decimal when working with binary data. You can visually inspect a hex byte and immediately know whether its high bit is set (any hex digit 8 or above has bit 3 = 1), whether the value is zero (0x00), or whether all bits are set (0xFF).
Hex / Binary / Decimal Calculator
Three-Way Number Base Converter
Enter a value in any field. The other two are calculated instantly. Hex input accepts 0–9 and A–F (upper or lower case). Binary input accepts only 0 and 1. Decimal input accepts positive integers up to 4,294,967,295.
Hexadecimal Notation Conventions
Different communities use different prefixes and suffixes to indicate that a number is hexadecimal rather than decimal:
| Notation | Example | Used in |
|---|---|---|
| 0x prefix | 0x1A3F | C/C++, Python, most programming languages, SDR software |
| $ prefix | $1A3F | Assembly language (Motorola style), some firmware tools |
| h or H suffix | 1A3Fh | Intel assembly language, microcontroller datasheets |
| Subscript 16 | 1A3F16 | Textbooks and technical documentation |
| No prefix | 1A3F | Memory maps where all addresses are hex by definition |
The 0x prefix is by far the most common in modern radio software. When you see 0xFF in SDR software configuration, 0x is telling you the following digits are hex, and FF = 255 decimal. When a transceiver service manual lists memory addresses like 0x8000 or 0xFFFF, it is using the same convention.
Hex in Ham Radio
Firmware files. Transceiver firmware updates are often distributed as Intel HEX files — a text format where each line contains a record type, byte count, address (in hex), and data bytes (in hex). Being able to read these files helps you verify that a firmware update is loading to the correct memory addresses and has the expected size.
Memory maps. Service manuals for radios based on microprocessors list their internal memory maps in hexadecimal. A radio might have its main program ROM at addresses 0x0000–0x7FFF, RAM at 0x8000–0x9FFF, and I/O registers at 0xC000 and above. Understanding these maps is essential for advanced repair and modification work.
Color codes in SDR software. The waterfall and spectrum displays in software like SDR# and CubicSDR use HTML-style color codes, which are written in hex. The color #1E3A5F is red = 0x1E (30 decimal), green = 0x3A (58), blue = 0x5F (95) — a dark navy blue. Being able to parse these values lets you customize display themes.
Digital mode data. Protocols like AX.25 (used by APRS) and D-STAR define their packet formats in hex. A typical AX.25 header starts with 0x7E (the flag byte, binary 01111110). Tools like Dire Wolf display raw packet data in hex for debugging. Being able to read it is genuinely useful when troubleshooting APRS igates or packet nodes.
Registers in transceivers. Modern radios contain integrated circuits whose internal registers are set by writing specific byte values. The datasheet for an Si5351 clock synthesizer (used in many homebrew SDR builds) lists register addresses and values in hex. Writing 0x4F to register 0x03 means something very specific, and working through these datasheets requires comfortable hex reading.
Frequently Asked Questions
Is 0x prefix mandatory when writing hex numbers?
No — it is a convention, not a rule. Context determines what notation is required. In C code, you must write 0x1A3F or the compiler reads it as a decimal number starting with an error (because A is not a decimal digit). In a memory map table where everything is hex by definition, the 0x is often omitted. In assembly language, the h suffix (1A3Fh) is common. Match whatever convention the document you are reading uses.
How large is a hex value that I see in software?
Each hex digit represents 4 bits, so count the hex digits and multiply by 4 to get the bit width. A 2-digit hex value (like FF) fits in 8 bits (one byte). A 4-digit value (like 1A3F) fits in 16 bits. An 8-digit value (like DEADBEEF) fits in 32 bits. The maximum 8-digit unsigned hex value is FFFFFFFF = 4,294,967,295 decimal.
Why do some memory addresses end in 0, 4, 8, or C in hex?
Many processors require data to be aligned to even multiples of 2, 4, or 8 bytes. An address ending in 0, 4, 8, or C (in hex) is a multiple of 4 bytes (32-bit alignment). An address ending in 0 or 8 is a multiple of 8 bytes (64-bit alignment). You will see this pattern in radio firmware memory maps and in DSP buffer addresses, where aligned access is faster than unaligned.
What is the difference between hex and ASCII?
ASCII (American Standard Code for Information Interchange) is a character encoding that assigns a number to each letter, digit, and punctuation mark. Those numbers are just ordinary integers, which happen to be frequently written in hex. For example, the letter A has ASCII code 65 decimal = 0x41 hex. When a radio stores a callsign in memory, each letter is stored as its ASCII byte value. Being able to convert between ASCII codes and hex characters is useful when examining raw memory dumps.
Test Your Knowledge
Answer the questions below to check your understanding. Every answer can be found in the lesson above.