Skip to main content

How to Convert Decimal to Hexadecimal (Step by Step)

Convert decimal to hexadecimal by repeatedly dividing by 16 and reading the remainders. This guide covers the method, a worked example, a decimal/hex reference table, and common mistakes.

👤 Tools Hub 📅 Jun 24, 2026 ⏱ 9 min read

How to Convert Decimal to Hexadecimal (Step by Step)

To convert decimal to hexadecimal, divide the decimal number by 16, write down the remainder, then keep dividing the quotient by 16 until you reach zero. Read the remainders from bottom to top, swapping any remainder of 10 through 15 for the letters A through F, and you have your hex value. For example, the decimal number 255 becomes FF, and 4096 becomes 1000. That repeated-division method is the whole trick, and once you have done it two or three times by hand it stops feeling like math and starts feeling like a recipe.

If you just need the answer right now, paste your number into the Decimal to Hex converter and it will return the hexadecimal value instantly, no signup. But it is genuinely worth understanding how the conversion works, because hexadecimal shows up everywhere a programmer, designer, or network engineer looks: memory addresses, color codes like #FF5733, MAC addresses, file signatures, and error codes. This guide walks through the manual method, gives you a fully worked decimal to hexadecimal example, and includes a clean reference table so you can spot-check yourself.

Why Hexadecimal Exists in the First Place

Computers count in binary: ones and zeros. Binary is correct but painful for humans because the strings get long fast. The number 255 is 11111111 in binary, eight digits to express something small. Hexadecimal is base 16, and because 16 is exactly 2 to the fourth power, every single hex digit maps cleanly onto a group of four binary digits. That tidy relationship is the entire reason hex is the preferred shorthand for binary data. One hex character replaces four bits, so a byte (eight bits) is always exactly two hex characters.

Decimal, the base-10 system we use daily, runs out of single-character symbols after 9. Hexadecimal needs sixteen symbols, so after 9 it borrows the first six letters of the alphabet: A is 10, B is 11, C is 12, D is 13, E is 14, and F is 15. That is the only conceptual hurdle in learning to convert decimal to hex. Everything else is plain division.

Decimal and Hexadecimal Digit Reference Table

Keep this table next to you the first few times you do a conversion. It maps every decimal value from 0 to 15 onto its single hex digit, which is the only translation you ever have to memorize.

DecimalHexadecimalBinary (4-bit)
000000
110001
220010
330011
440100
550101
660110
770111
881000
991001
10A1010
11B1011
12C1100
13D1101
14E1110
15F1111

The Repeated Division Method, Explained

The standard way to convert decimal to hexadecimal by hand is the repeated division-by-16 method, sometimes called the remainder method. Here is the procedure in plain steps:

  1. Take your decimal number and divide it by 16.
  2. Write down the whole-number quotient and the remainder separately.
  3. The remainder is a hex digit. If it is 10 or higher, convert it to a letter using the reference table above.
  4. Now divide the quotient by 16 and record the new remainder the same way.
  5. Repeat until the quotient becomes 0.
  6. Read all the remainders from the last one you wrote to the first one. That bottom-to-top sequence is your hexadecimal number.

The reason you read the remainders in reverse is that the first remainder you calculate represents the least significant digit (the rightmost position), while the last remainder represents the most significant digit (the leftmost position). It feels backwards the first time, but it is consistent with how positional number systems work in every base.

Rule of thumb: the number of times you can divide by 16 before hitting zero equals the number of hex digits in your answer. A decimal value under 256 always fits in two hex digits; under 4096 it fits in three.

Worked Example: Convert 3,491 to Hexadecimal

Let us walk through a real decimal to hexadecimal example with a number large enough to need three digits. We will convert 3491.

  • Step 1: 3491 divided by 16 equals 218, with a remainder of 3. (Because 218 times 16 is 3488, and 3491 minus 3488 is 3.) First remainder: 3.
  • Step 2: 218 divided by 16 equals 13, with a remainder of 10. (13 times 16 is 208; 218 minus 208 is 10.) The remainder 10 becomes the letter A.
  • Step 3: 13 divided by 16 equals 0, with a remainder of 13. (16 does not go into 13, so the quotient is 0 and the entire 13 is the remainder.) The remainder 13 becomes the letter D.
  • Step 4: The quotient is now 0, so we stop.

Now read the remainders from bottom to top: D, then A, then 3. The hexadecimal value of 3491 is DA3. To double-check, you can expand it back out: D is 13, so D times 256 (16 squared) is 3328; A is 10, so A times 16 is 160; and 3 times 1 is 3. Add them: 3328 + 160 + 3 = 3491. The conversion balances.

A Second Example: Convert 255 to Hexadecimal

Smaller numbers make the pattern obvious. To convert 255: 255 divided by 16 is 15 remainder 15. The remainder 15 is F. Then 15 divided by 16 is 0 remainder 15, which is another F. Reading bottom to top gives FF. This is why 255 shows up so often as the maximum value of a single byte and why color channels in hex go up to FF.

Converting Decimal Fractions to Hexadecimal

Most everyday conversions involve whole numbers, but you can also convert a decimal fraction to hex. The method flips: instead of dividing by 16, you multiply the fractional part by 16, record the integer part of the result as a hex digit, then keep multiplying the leftover fraction by 16. You read these digits top to bottom (the opposite of the whole-number method). For instance, 0.5 in decimal times 16 is 8.0, so 0.5 equals 0.8 in hex. Fractions can repeat forever in hex just as they do in decimal, so you usually round to a fixed number of places. For most practical work, an automated converter handles this far more reliably than pencil and paper.

Common Mistakes When Converting Decimal to Hex

Even people who understand the dec to hex method trip over the same handful of errors. Watch for these:

  • Reading remainders in the wrong order. The most frequent mistake. Always read from the last remainder up to the first.
  • Forgetting to convert 10 through 15 into letters. Writing "12" where you mean C produces a number that is simply wrong. Each hex position holds exactly one symbol.
  • Stopping too early. Keep going until the quotient is genuinely 0, not until it is small. A quotient of 5 still needs one more division to produce the leading digit.
  • Confusing the bases. Hex 10 is decimal 16, not decimal 10. Context matters, which is why hex values are often prefixed with 0x or # to signal the base.

Where You Will Actually Use Decimal to Hex Conversion

This is not an academic exercise. Knowing how to convert decimal to hex pays off in plenty of real scenarios:

  • Web and graphic design: CSS colors are written in hex. A designer who knows that RGB (255, 87, 51) is #FF5733 can tweak palettes without a color picker.
  • Programming and debugging: Memory addresses, pointers, and hex dumps are all base 16. Reading a stack trace often means reading hex.
  • Networking: MAC addresses and IPv6 addresses are expressed in hexadecimal.
  • Embedded systems: Register values, bitmasks, and firmware constants are nearly always written in hex for readability.

Because hex pairs so neatly with binary, it often helps to think in all three bases at once. If you frequently move between formats, the Binary to Hex converter is a fast companion, and the Decimal to Binary tool handles the base-2 leg of the journey. You can find the full set of base-conversion utilities in the Binary Converters hub.

Manual Method vs. Using a Converter

Doing conversions by hand builds intuition and is worth practicing until it clicks. But for anything beyond a couple of digits, or when accuracy matters in production code, an instant tool removes the risk of a misread remainder. The Decimal to Hex converter on freeseosmasher.com runs entirely in your browser, returns the result the moment you type, and never asks you to create an account. Use the manual method to learn, and the tool to move fast.

If you enjoy working across number systems and encodings, you may also like our deeper guides on the binary translator and the Morse code translator, both of which cover the same translate-between-systems thinking from a different angle.

Frequently Asked Questions

What is the easiest way to convert decimal to hexadecimal?

The easiest manual way is repeated division by 16: divide, record the remainder, repeat with the quotient until you reach zero, then read the remainders bottom to top, converting any 10 through 15 into A through F. For speed and zero errors, paste the number into an online decimal to hex converter.

What is 100 in hexadecimal?

Decimal 100 divided by 16 is 6 remainder 4, and 6 divided by 16 is 0 remainder 6. Reading bottom to top gives 64. So decimal 100 equals 64 in hexadecimal.

Why do hex numbers use the letters A through F?

Hexadecimal is base 16, so it needs sixteen distinct single-character symbols. The digits 0 through 9 cover the first ten values, and the letters A through F stand in for the values 10 through 15, which have no single decimal digit of their own.

How many hex digits do I need for a given decimal number?

Count how many times you can divide by 16 before reaching zero. Any decimal value below 16 needs one hex digit, below 256 needs two, below 4096 needs three, and below 65536 needs four. Each additional hex digit multiplies the range by 16.

What does the 0x prefix mean in hexadecimal?

The 0x prefix is a convention used in many programming languages to signal that the number that follows is hexadecimal rather than decimal. For example, 0xFF means hex FF, which is decimal 255. In web design, the # symbol plays a similar role for color codes.

Can I convert a decimal fraction to hexadecimal?

Yes. For the fractional part, multiply by 16 repeatedly instead of dividing, recording the integer part of each result as a hex digit and reading those digits top to bottom. Fractions can repeat indefinitely in hex, so the result is usually rounded to a set number of places.

Is hexadecimal the same as binary?

No, but they are closely related. Binary is base 2 and hexadecimal is base 16. Because 16 equals 2 to the fourth power, each hex digit corresponds exactly to four binary digits, which is why hex is used as a compact, human-readable shorthand for binary data.

What is the largest two-digit hexadecimal number in decimal?

The largest two-digit hex number is FF, which equals 15 times 16 plus 15, or 255 in decimal. That is exactly the maximum value a single byte can hold, which is why two hex digits represent one byte.

Tools Hub
Free online tools, every day

Share on Social Media:

ads

Please disable your ad blocker!

We understand that ads can be annoying, but please bear with us. We rely on advertisements to keep our website online. Could you please consider whitelisting our website? Thank you!