Hexadecimal Guide: Understanding Hex Numbers and Colors
Quick answer
Master hexadecimal numbers. Learn hex counting, conversions, and why hex is used for colors, memory addresses, and computing. This guide answers that in plain language, with the practical steps first and the background afterwards.
Key facts
| What this article covers | Master hexadecimal numbers. Learn hex counting, conversions, and why hex is used for colors, memory addresses, and computing. |
|---|---|
| Topic | Tech |
| Reading time | 10 min read |
| Published | March 28, 2026 |
| Written by | The SimpleCounter editorial team, who build and use these counting tools. |
| Cost of the tools mentioned | Free, with no account required. |
Hexadecimal shows up the moment you pick a color in a design tool, look at a memory address in a debugger, or read a MAC address off a router label. It looks intimidating with letters mixed into numbers, but it's just counting in base 16 instead of base 10, and once the pattern clicks it's genuinely faster to work with than binary for a lot of computing tasks.
Why Base 16 Instead of Base 10
Decimal (base 10) uses digits 0 through 9. Hexadecimal (base 16) uses digits 0 through 9 and then letters A through F to represent 10 through 15, giving 16 total symbols per digit. So counting in hex goes: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, then 10 (which is 16 in decimal), 11 (17 in decimal), and so on. Hex is popular in computing because it maps cleanly to binary: exactly 4 binary bits equal one hex digit, which makes hex a compact way to write out binary data without losing the underlying bit pattern.
Converting Hex to Decimal
Each hex digit represents a power of 16, read right to left starting at 16^0. For the hex number 2F: F is in the 16^0 place and 2 is in the 16^1 place. F = 15 in decimal, so the value is (2 x 16) + (15 x 1) = 32 + 15 = 47. For a longer example, 1A3 in hex: 1 x 16^2 + A x 16^1 + 3 x 16^0 = 1x256 + 10x16 + 3x1 = 256 + 160 + 3 = 419 in decimal.
Converting Decimal to Hex
Repeatedly divide by 16 and track the remainders, reading them bottom to top. For 500 in decimal: 500 / 16 = 31 remainder 4. Then 31 / 16 = 1 remainder 15 (which is F in hex). Then 1 / 16 = 0 remainder 1. Reading remainders bottom to top: 1, F, 4, giving 1F4 in hex. You can check this: 1x256 + 15x16 + 4x1 = 256 + 240 + 4 = 500. Matches.
Hex Colors Are Just Three Bytes
A web color like #3498DB breaks into three pairs of hex digits, one each for red, green, and blue: 34, 98, and DB. Each pair ranges from 00 to FF, which is 0 to 255 in decimal, matching the standard 8-bit color channel range. Converting 34 to decimal: 3x16 + 4 = 52. Converting 98: 9x16 + 8 = 152. Converting DB: D=13, B=11, so 13x16 + 11 = 219. This color is RGB(52, 152, 219), a medium blue. Pure white is #FFFFFF (255, 255, 255) and pure black is #000000 (0, 0, 0), since FF is the maximum two-digit hex value and 00 is the minimum.
| Hex | Decimal | Common use |
|---|---|---|
| #FF0000 | 255, 0, 0 | Pure red |
| #00FF00 | 0, 255, 0 | Pure green |
| #808080 | 128, 128, 128 | Medium gray |
| #1A1A1A | 26, 26, 26 | Near-black UI background |
Memory Addresses and Byte Values
Programmers use hex for memory addresses and byte values because a single byte, which holds values 0-255, maps exactly to two hex digits, 00 to FF, with no leftover or partial digit. A memory address like 0x7FFE3A20 is a hex number (the 0x prefix just marks it as hex in code). Writing that same address in decimal, 2147352096, is harder to scan visually and doesn't align neatly with the underlying binary structure the way hex does.
Hex to Binary Is a Direct Substitution
Because 16 is 2 to the 4th power, each hex digit converts to exactly 4 binary bits with no remainder, using this mapping: 0=0000, 1=0001, ... 9=1001, A=1010, B=1011, C=1100, D=1101, E=1110, F=1111. So hex 2F becomes 0010 1111 in binary, and hex 1A3 becomes 0001 1010 0011. This digit-by-digit substitution is why hex is favored over decimal for representing binary data compactly and accurately.
Convert Hex Numbers Instantly
Doing hex-to-decimal or decimal-to-hex conversions by hand is manageable for small numbers but gets tedious and error-prone for longer values or color codes with six digits. The hex calculator on this site converts between hex, decimal, and binary instantly, so whether you're decoding a color value or checking a memory address, you get the right answer without manual place-value math.
How this page relates to the rest of the site
- Type of
- Guide
- Related tools
- Calculators and converters
- Published by
- SimpleCounter
Related articles
Binary Calculator Guide: Binary Arithmetic
Learn binary number system and computer math.
Data Storage Guide: Bytes, KB, MB, GB, TB
Understand digital storage units and conversions.
Number Base Converter Guide: Binary, Hex, Octal
Master number system conversions.
Get Counting Tips in Your Inbox
Subscribe for productivity tips, counting techniques, and new feature updates.
No spam, unsubscribe anytime.