CalcUnit Logo
Converters

Decoding Hexadecimal: Converting Base-16 to Decimal

Learn how to manually translate hexadecimal color codes and MAC addresses back into standard Base-10 numbers using the power-of-16 positional system.

CSBy CalcUnit Computer Science ExpertsPublished 12 min read
Decoding Hexadecimal: Converting Base-16 to Decimal

Introduction: Why Computers Speak in Base-16

Instantly translate complex Base-16 computer codes into readable numbers using our Hex to Decimal Converter, or read on to master the math of hexadecimal conversion.

If you are a web developer, you use Hexadecimal (Base-16) every single day. When you write CSS and set a background color to #FF5733, you are writing in Hex.

Hexadecimal is used by programmers because it compresses massive binary strings into incredibly short, readable codes. But how do you convert that strange mixture of letters and numbers back into standard human numbers (Base-10)?

The good news is that hexadecimal uses the same positional logic you already know from decimal numbers. Only the base changes: sixteen instead of ten.

Once that idea clicks, every conversion in this guide becomes a short multiplication-and-addition exercise. No special talent is required, just careful place values.

This guide covers the digit table, the step-by-step method, several worked examples, color codes, binary comparisons, and the mistakes that cause most wrong answers.

Number Bases Compared: Decimal, Binary, and Hexadecimal

A number base tells you how many symbols a system uses and what each position is worth. Decimal uses ten symbols, binary uses two, and hexadecimal uses sixteen.

System Base Symbols Used Value of Positions (Right to Left)
Binary 2 0, 1 1, 2, 4, 8, 16
Decimal 10 0-9 1, 10, 100, 1,000, 10,000
Hexadecimal 16 0-9, A-F 1, 16, 256, 4,096, 65,536

The same quantity can be written in all three systems. The number twenty-six is 26 in decimal, 11010 in binary, and 1A in hexadecimal.

Hexadecimal wins on compactness for computer work. Long binary strings are hard to read and easy to mistype, while hex keeps the same information much shorter.

Hex also aligns perfectly with binary, as a later section shows. Each hex digit represents exactly four binary digits, with no leftover fractions or awkward grouping.

Programmers often mark hex numbers with a 0x prefix, such as 0x1A, so readers know the base. CSS color codes use the # symbol for the same purpose.

Run your own numbers

Enter your own numbers and see the result instantly — free, no signup.

Open the Calculator →

The Base-16 Dictionary

The decimal system is Base-10 (using digits 0-9). Hexadecimal is Base-16. It needs 16 unique single-character symbols.

Because we only have 10 numeric digits, Hexadecimal borrows the first six letters of the alphabet to represent the numbers 10 through 15.

The Hex Dictionary:

  • 0 through 9 = 0 through 9
  • A = 10
  • B = 11
  • C = 12
  • D = 13
  • E = 14
  • F = 15

For reference, here is the complete table with the binary form of each digit included. This table is worth memorizing if you convert values by hand often.

Hex Digit Decimal Value Binary (4 Bits)
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

Hex is not case-sensitive in most contexts. A lowercase ff and an uppercase FF both mean 255, although uppercase remains the common style in documentation.

The Positional Method (Powers of 16)

Just like decimal uses powers of 10 (1s column, 10s column, 100s column), Hexadecimal uses powers of 16.

Reading from right to left, the columns in a Hex number are:

  • Position 1: 16^0 = The 1s column
  • Position 2: 16^1 = The 16s column
  • Position 3: 16^2 = The 256s column
  • Position 4: 16^3 = The 4,096s column

To convert a Hex string to decimal, you simply multiply the digit in each column by its positional value, and then add them all together.

Add one more useful column to that list: the fifth position is 16^4 = 65,536. Longer hex strings simply keep multiplying the place value by sixteen.

The method works in four repeatable steps. Write the digits in order, label each position, multiply each digit by its place value, and add the products.

Work right to left when labeling positions, because the rightmost digit always sits in the 1s column. The calculation itself can then be written left to right for readability.

Example 1: A Two-Digit Hex Code (1A)

Convert the Hex code 1A to decimal.

  1. Look at the right digit (A). The dictionary says A = 10. Multiply by the 1s column: 10 × 1 = 10.
  2. Look at the left digit (1). Multiply by the 16s column: 1 × 16 = 16.
  3. Add them together: 10 + 16 = 26. The Hex code 1A equals 26 in decimal.

Example 2: A Massive Hex Code (2F4)

Convert the Hex code 2F4 to decimal.

  1. Right digit (4): 4 × 1 = 4
  2. Middle digit (F = 15): 15 × 16 = 240
  3. Left digit (2): 2 × 256 = 512
  4. Add them together: 4 + 240 + 512 = 756. The Hex code 2F4 equals 756 in decimal.

More Worked Examples, Step by Step

Practice with graded examples builds speed quickly. The table below applies the same method to values of increasing length, so you can check your own attempts line by line.

Hex Value Breakdown Decimal Result
3C (3 × 16) + (12 × 1) = 48 + 12 60
A3 (10 × 16) + (3 × 1) = 160 + 3 163
C0 (12 × 16) + (0 × 1) = 192 + 0 192
100 (1 × 256) + (0 × 16) + (0 × 1) 256
ABC (10 × 256) + (11 × 16) + (12 × 1) = 2,560 + 176 + 12 2,748

Notice the trap hidden in 100. In hexadecimal, 100 does not mean one hundred; it means 256, because the left digit sits in the 256s column.

Now try a four-digit value: BEEF, a famous test value in computing. Its digits are B = 11, E = 14, E = 14, and F = 15.

Multiply each digit by its place value: 11 × 4,096 = 45,056; 14 × 256 = 3,584; 14 × 16 = 224; and 15 × 1 = 15.

Add the products: 45,056 + 3,584 + 224 + 15 = 48,879. So the hex value BEEF equals 48,879 in decimal.

For long strings like this, a single arithmetic slip is easy to make by hand. Check long conversions with the Hex to Decimal Converter before you rely on them.

To practice in the opposite direction, from ordinary numbers into hex, use our Decimal to Hex Converter and compare each result with your manual work.

Converting Decimal Back to Hexadecimal: A Quick Preview

Reverse conversion uses repeated division by sixteen. Divide the decimal number by 16, record the remainder, and repeat with the quotient until it reaches zero.

The remainders, read in reverse order, form the hex answer. Any remainder from 10 to 15 must be written as its letter: A, B, C, D, E, or F.

Take 2,748, the decimal result from the ABC example above. Dividing gives remainders that rebuild A, then B, then C, confirming the round trip works.

Specifically: 2,748 ÷ 16 = 171 remainder 12 (C); 171 ÷ 16 = 10 remainder 11 (B); 10 ÷ 16 = 0 remainder 10 (A). Reading upward gives ABC.

This reverse check is a powerful habit. If converting back does not return your starting value, an error exists in one of the two directions.

Hexadecimal and Binary: Two Sides of the Same Coin

Every hex digit equals exactly four binary digits, called bits. That clean relationship is the main reason hexadecimal became the standard shorthand for binary data.

Converting between them needs no multiplication at all. Replace each hex digit with its four-bit binary group from the dictionary table, and join the groups together.

For example, hex A is binary 1010, and hex F is binary 1111. So the hex value AF becomes binary 10101111, group by group.

Going the other way, split a binary string into groups of four from the right, then replace each group with one hex digit. Try it with our Binary to Decimal Converter.

For example, binary 0010 1010 splits into 0010 (2) and 1010 (A), giving hex 2A. Checking in decimal: 2 × 16 + 10 = 42, and binary 101010 also equals 42.

If you need the binary form of a decimal number first, the Decimal to Binary Converter handles that step, after which the grouping method finishes the job.

Hex Digit Binary Group Decimal
2 0010 2
A 1010 10
F 1111 15

Why Colors Use Hexadecimal

In web design, colors are created using the RGB model (mixing Red, Green, and Blue light). A computer monitor can display 256 levels of intensity for each color, ranging from 0 to 255.

If you wanted to write the code for pure red in decimal, you would have to write: rgb(255, 0, 0). In Hexadecimal, the number 255 is represented by exactly two characters: FF.

Therefore, the Hex color code for pure red is simply #FF0000.

  • FF (255 Red)
  • 00 (0 Green)
  • 00 (0 Blue)

Hexadecimal allows the computer to perfectly compress 16 million different color combinations into strict, uniform 6-character strings.

More precisely, 256 × 256 × 256 = 16,777,216 possible combinations exist, because each of the three channels offers 256 levels. Designers usually round that figure to "16 million colors."

Decoding a Real Color Code: #FF5733

Split a six-digit color code into three pairs. In #FF5733, the pairs are FF for red, 57 for green, and 33 for blue.

Convert each pair separately. FF = (15 × 16) + 15 = 255. Next, 57 = (5 × 16) + 7 = 87. Finally, 33 = (3 × 16) + 3 = 51.

So #FF5733 is exactly rgb(255, 87, 51), a strong orange-red. Full red, moderate green, and low blue produce that warm result.

This pair-by-pair method works for every CSS color. Pure green is #00FF00, pure blue is #0000FF, white is #FFFFFF, and black is #000000.

Some CSS colors use a three-digit shorthand, such as #F53. Each digit is doubled, so #F53 expands to #FF5533 before you decode it as pairs.

Where Else You Will Meet Hexadecimal

Memory addresses are commonly shown in hex, because addresses are large numbers that would be unwieldy in binary and meaningless-looking in decimal.

Character encoding uses hex as well. In UTF-8 and ASCII references, each byte is often identified by a two-digit hex value, making tables compact and uniform.

Error codes, file signatures, and cryptographic hashes also appear in hex. A hash written in hex is far shorter than the same value written out in binary.

In each case, the reason is identical: hex is compact for humans, yet it maps perfectly onto the binary data that machines actually store and process.

Common Hex Conversion Mistakes

The most common mistake is reading hex digits as decimal digits. The hex string 10 means sixteen, not ten, because its left digit sits in the 16s column.

A second mistake is forgetting that letters have values. Treating A as 1, or skipping it entirely, breaks every calculation that contains a letter digit.

A third mistake is labeling positions from the left. Place values must always be assigned from the right, starting with 16^0 = 1 for the final digit.

A fourth mistake is dropping leading zeros inside color codes. In #00FF00, the opening 00 is meaningful data: it sets the red channel to exactly zero.

A fifth mistake is arithmetic drift in long strings. With six or more digits, write each product on its own line before adding, rather than calculating mentally.

Finally, do not confuse the prefix with the value. In 0x2F4, the 0x only labels the base; the number to convert is still 2F4, which equals 756.

Practical Tips for Faster, Safer Conversions

Memorize three anchor values first: 10 hex = 16, FF = 255, and 100 hex = 256. Many everyday conversions can be estimated quickly from those landmarks.

Convert color codes one pair at a time instead of tackling all six digits at once. Smaller chunks mean fewer place-value errors and easier checking.

Use the reverse division method as a self-test. Converting your decimal answer back to hex should return the original string exactly, every single time.

When reading unfamiliar hex, say the letters as their values under your breath: "B, eleven; E, fourteen." That habit prevents the common slip of treating letters as decoration.

For production work, accessibility values, or long identifiers, always verify with a tool. Manual skill builds understanding; the Hex to Decimal Converter protects deadlines.

FAQ

Why are MAC addresses written in Hexadecimal? Every network card in the world has a unique MAC address. A MAC address is a massive 48-bit number.

If you wrote a 48-bit number in binary, it would be a completely unreadable string of 48 ones and zeros. By converting it to Hexadecimal, the exact same data is compressed into just 12 characters (e.g., 00:1A:2B:3C:4D:5E), making it infinitely easier for network administrators to read and type.

What does the 0x prefix mean in programming? The 0x prefix tells readers and compilers that the digits after it are hexadecimal. It is a label only, and it is never included in the conversion calculation itself.

Is hexadecimal case-sensitive? No. Uppercase and lowercase letters represent the same values, so ff, Ff, and FF all equal 255. Styles differ by language and team, but the math is identical.

How many digits does a byte need in hex? Exactly two. A byte holds values from 0 to 255, and two hex digits cover precisely that range, from 00 through FF, with nothing wasted.


Converting long strings of letters and numbers by hand is highly prone to mathematical error. Decode Base-16 instantly using the CalcUnit Hex to Decimal Converter.

NameDecoding Hexadecimal: Converting Base-16 to Decimal
DescriptionLearn how to manually translate hexadecimal color codes and MAC addresses back into standard Base-10 numbers using the power-of-16 positional system.
PublishedJune 12, 2026 · CalcUnit Computer Science Experts
Filed underconverters · hex to decimal

Keep Reading