Decimal 255 converted to hexadecimal FF using repeated division by 16, with remainders read from bottom to top

How to Convert Decimal to Hexadecimal: Steps & Examples

By ProURLMonitor Team

To convert a decimal number to hexadecimal manually, repeatedly divide the number by 16, record each remainder, convert any remainder from 10 through 15 into its hex letter (A-F), and read the remainders from last to first. For example, decimal 255 converts to hexadecimal FF: 255 ÷ 16 = 15 remainder 15 (F), then 15 ÷ 16 = 0 remainder 15 (F), giving FF when read bottom to top. This guide walks through why that method works, a full A-F reference table, several verified examples, and the mistakes people most often make along the way.

What Is the Decimal Number System?

Decimal is the base-10 number system most people use every day, built from ten digit symbols: 0 through 9. Each position in a decimal number represents a power of 10 (1, 10, 100, 1000…), which is why decimal is also called "base 10."

What Is Hexadecimal?

Hexadecimal is a base-16 number system. Base 16 needs sixteen distinct symbols per digit position, but decimal only supplies ten (0-9), so hexadecimal borrows six letters — A through F — to cover the remaining values:

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

Those letters aren't arbitrary placeholders — they're digit values, standing in for 10 through 15 the same way the symbol "9" stands in for the value nine. Like decimal, hexadecimal is a positional number system: each digit's contribution to the total depends on where it sits, representing a power of 16 rather than a power of 10.

Decimal to Hex Conversion Table

Every decimal value from 0 to 15 maps to exactly one hexadecimal digit — this table is the foundation the rest of the conversion process builds on:

DecimalHex
00
11
22
33
44
55
66
77
88
99
10A
11B
12C
13D
14E
15F

Any remainder produced during decimal-to-hex division must fall between 0 and 15 — there's no other possible outcome, since dividing by 16 can only ever leave a remainder from 0 up to one less than 16. That's exactly why this table only needs 16 rows.

How to Convert Decimal to Hexadecimal Step by Step

The standard manual method is repeated division by 16:

  1. Divide the decimal number by 16.
  2. Record the integer quotient and the remainder.
  3. Convert the remainder to a hex digit if it's 10 or higher, using the table above (10→A, 11→B, and so on).
  4. Divide the quotient by 16 again, and repeat steps 2-3.
  5. Continue until the quotient reaches 0.
  6. Read the remainders from last to first (bottom to top). That sequence of hex digits is the final result.

Why Are Remainders Read Bottom to Top?

This isn't an arbitrary rule — it follows directly from what each division actually calculates. The first division tests the smallest possible hex place value, 16⁰ (the "ones" position): the remainder from that step is exactly the digit that belongs there. The second division, performed on the quotient, tests the next place value up, 16¹. Each division after that tests a progressively larger power of 16.

Since the largest place value in the number is the last one calculated, and hexadecimal numbers are written with the largest place value on the left, the last remainder produced has to come first when you write out the answer. Reading remainders from bottom to top simply lines up "largest place value first," which is how hexadecimal (and decimal, and binary) numbers are normally written.

Example: Convert 255 Decimal to Hex

Here is the method applied in full to decimal 255:

255 ÷ 16 = 15 remainder 15  →  F
 15 ÷ 16 =  0 remainder 15  →  F

The quotient reaches 0 after the second division, so the process stops. Reading the remainders from bottom to top gives F, F — in other words:

255₁₀ = FF₁₆

Verifying the Result

The conversion can be checked by reversing it: multiply each hex digit by its place value (a power of 16) and add the results.

F × 16¹ + F × 16⁰
= 15 × 16 + 15 × 1
= 240 + 15
= 255

That matches the original decimal number, confirming FF is correct.

More Decimal to Hex Examples

10 (a value below 16 — single hex digit)

Decimal values from 0 through 15 never need a division step, since they fit inside a single hex digit already. 10 in decimal is simply A in hex, directly from the table above.

16 (the first boundary value)

16 ÷ 16 = 1 remainder 0
 1 ÷ 16 = 0 remainder 1

Bottom to top: 1, 010₁₆. Decimal 16 is the smallest number that needs two hex digits, the same way decimal rolls from a single digit (9) to two digits (10) once it runs out of symbols.

42 (a remainder that becomes a letter)

42 ÷ 16 = 2 remainder 10  →  A
 2 ÷ 16 = 0 remainder  2

Bottom to top: 2, A2A₁₆. Checking it: 2 × 16 + 10 × 1 = 32 + 10 = 42. ✓

1000 (three division steps)

1000 ÷ 16 = 62 remainder  8
  62 ÷ 16 =  3 remainder 14  →  E
   3 ÷ 16 =  0 remainder  3

Bottom to top: 3, E, 83E8₁₆. Checking it: (3 × 256) + (14 × 16) + (8 × 1) = 768 + 224 + 8 = 1000. ✓

Summary Table

DecimalDivisions & RemaindersHex
10(below 16 — no division needed)A
1616÷16=1 r0, 1÷16=0 r110
4242÷16=2 r10(A), 2÷16=0 r22A
255255÷16=15 r15(F), 15÷16=0 r15(F)FF
10001000÷16=62 r8, 62÷16=3 r14(E), 3÷16=0 r33E8

Every result in this table was verified by converting it back to decimal using powers of 16.

Decimal Values 0-15: A Special Case

Any decimal number from 0 through 15 converts to a single hexadecimal digit, with no division required — the value simply is the hex digit, per the table earlier in this guide:

  • 10 → A
  • 11 → B
  • 12 → C
  • 13 → D
  • 14 → E
  • 15 → F

Decimal 16 is the turning point: it's the smallest value that needs a second hex digit, becoming 10₁₆ (one 16, zero ones) — not to be confused with decimal ten. And 0 is its own special case: 0 in decimal is 0 in hexadecimal, since there's nothing to divide.

Decimal to Hex Formula

There's no single algebraic formula that outputs a hex string the way, say, converting Celsius to Fahrenheit has one equation. What decimal-to-hex conversion actually relies on is a repeatable algorithm — division by the target base — expressed most simply as:

remainder = decimal number mod 16
quotient  = floor(decimal number ÷ 16)

Repeat using the quotient as the new decimal number until the quotient reaches 0, then reverse the sequence of remainders. The underlying math is positional notation: any whole number can be written as a sum of digit values multiplied by powers of the base, and repeated division simply extracts those digit values one place value at a time, starting from the smallest.

Are There Other Ways to Convert Decimal to Hex?

Repeated division by 16 is the standard, most direct manual method, but it isn't the only path to the same answer:

  • Through binary. Convert decimal to binary first using repeated division by 2 (see how to convert decimal to binary), then group the binary digits into sets of four, from the right, and convert each group to its hex digit. This works because 16 = 2⁴, so every hex digit corresponds exactly to a 4-bit binary group — the relationship covered in binary vs hexadecimal. It's a valid alternative, but it adds an extra conversion step compared to dividing by 16 directly.
  • Calculator or converter. For longer numbers, or when accuracy matters more than practicing the method, the Decimal to Hex Converter performs the same division-by-16 process instantly and shows the full breakdown.

Repeated division by 16 remains the method worth learning by hand, since it works directly and doesn't require an intermediate base.

Decimal to Hex vs Hex to Decimal

These are inverse operations that use different mechanics:

  • Decimal to hex: repeatedly divide by 16 and read the remainders from bottom to top.
  • Hex to decimal: multiply each hex digit by the power of 16 matching its position, then add the results.

If you're starting from a hex value instead of a decimal one, see how to convert hex to decimal for that formula and worked examples in full.

What Does 0x Mean Before a Hex Number?

Many programming languages mark a hexadecimal literal with a 0x prefix so it isn't mistaken for a decimal number — 0xFF and FF represent the identical value, 255 in decimal. The prefix is notation, not part of the number itself: apply the conversion steps in this guide to the digits after 0x, and ignore the prefix. Not every language or context uses 0x — some use other markers, such as a trailing h — so the prefix's presence depends on where the hex value is being written, not on the value itself.

Common Decimal-to-Hex Mistakes

  • Dividing by 10 instead of 16. This is the single most common slip — decimal-to-hex conversion only works with powers of 16 (1, 16, 256, 4096…), not powers of 10.
  • Forgetting that remainders 10-15 become A-F. A remainder of 12 is not written as "12" in the final hex result — it becomes C.
  • Reading remainders top to bottom instead of bottom to top. This reverses the digit order entirely; for 255, reading top to bottom would still give FF (a coincidence of repeated digits), but for 42 it would incorrectly give A2 instead of 2A.
  • Dividing the remainder again instead of the quotient. The quotient carries forward into the next division step; the remainder only gets recorded as a digit. Mixing the two up produces a completely different result.
  • Stopping one division too early. The process only ends once the quotient reaches 0 — stopping while the quotient is still 1 or more drops a leading hex digit.
  • Confusing decimal-to-hex with hex-to-decimal. One divides repeatedly and collects remainders; the other multiplies digits by powers of 16 and sums them. They're inverse processes, not the same steps run differently.
  • Treating A-F as arbitrary letters rather than digit values. A, B, C, D, E, and F stand for the fixed values 10 through 15 — they aren't interchangeable symbols and can't be assigned differently.

How to Check Your Answer

The most reliable way to build confidence with manual conversion is to work through it by hand first, then confirm the result. The Decimal to Hex Converter uses exact integer math and shows the same division-by-16 breakdown used throughout this guide, making it easy to spot a dropped remainder or an early stop.

Reversing the check is useful too: convert your hex result back to decimal using place values (powers of 16), or with the Hex to Decimal Converter, and confirm it matches the number you started with.

Frequently Asked Questions

How do you convert decimal to hexadecimal? Divide the decimal number by 16 and record the remainder, converting any remainder from 10-15 to A-F. Divide the resulting quotient by 16 again and repeat until the quotient reaches 0, then read the remainders from bottom to top — that sequence of digits is the hexadecimal result.

Why do you divide by 16 when converting decimal to hex? Hexadecimal is base 16, so each digit position is worth a power of 16 instead of a power of 10. Dividing by 16 repeatedly strips off one hex digit at a time: the remainder at each step is exactly the value (0-15) that belongs in that position.

What do A through F mean in hexadecimal? A, B, C, D, E, and F are the six extra digit symbols hexadecimal needs beyond 0-9, since base 16 requires sixteen distinct symbols per position. They stand for decimal values 10 through 15: A=10, B=11, C=12, D=13, E=14, F=15.

What is 255 in decimal converted to hexadecimal? 255 in decimal equals FF in hexadecimal. Dividing 255 by 16 gives a quotient of 15 with remainder 15 (F), and dividing 15 by 16 gives a quotient of 0 with remainder 15 (F). Reading the remainders bottom to top gives FF.

Why are the remainders read from bottom to top? The first division produces the remainder for the smallest place value (16⁰), and each division after that produces the remainder for the next larger place value. Since the largest place value is found last, reading remainders from the last one calculated back to the first puts them in the correct order, from most significant hex digit to least significant.

What is decimal 16 in hexadecimal? Decimal 16 is 10 in hexadecimal. Dividing 16 by 16 gives quotient 1, remainder 0; dividing 1 by 16 gives quotient 0, remainder 1. Reading bottom to top gives 10 — hexadecimal's first two-digit value, the same way decimal rolls from 9 to 10.

Can you convert decimal to hex through binary? Yes — convert decimal to binary first (repeated division by 2), then group the binary digits into sets of four and convert each group to a hex digit. It produces the same result as dividing by 16 directly, but adds an extra conversion step, so repeated division by 16 is usually faster for a direct decimal-to-hex conversion.

How can I check a decimal-to-hex conversion? Work the conversion by hand first, then verify it with the Decimal to Hex Converter, which uses exact integer math. You can also reverse-check by converting your hex result back to decimal using place values (powers of 16) and confirming it matches the number you started with.

Try Our Free SEO Tools

Put what you learned into action with our free SEO analysis tools.