Developer utility · decimal to hex converter

Decimal to Hex Converter

Convert a non-negative decimal integer to hexadecimal with exact results. The shared workspace also shows binary, octal and UTF-8 interpretations. The visible division steps explain where every hexadecimal digit comes from, which is useful for study and for checking a programming value.

Up to 4,096 characters. No value is sent to a server.

Ready to convert locally.

Your conversion results will appear here.

Choose an input format, enter a value and select Convert to see binary, decimal, hex, octal and text results.

Use the tool

How to use this converter

  1. 1

    Enter a non-negative decimal integer.

  2. 2

    Select Convert to calculate the hexadecimal value.

  3. 3

    Review the result and the repeated-division explanation, then copy it.

Understand the result

How it works

Decimal to hexadecimal conversion repeatedly divides by 16. The remainder is the next hexadecimal digit from the right; values 10 through 15 are written as A through F. Repeat with the quotient until it reaches zero, then read the remainders from bottom to top. For 255, the two remainders are 15 and 15, so the result is FF.

Practical notes

A worked decimal-to-hex example

To convert 4987, divide by 16: 4987 ÷ 16 = 311 remainder 11, which is B. Then 311 ÷ 16 = 19 remainder 7, 19 ÷ 16 = 1 remainder 3, and 1 ÷ 16 = 0 remainder 1. Reading the remainders upward gives 137B.

The same result can be checked by place value: 1×16³ + 3×16² + 7×16¹ + 11×16⁰ = 4096 + 768 + 112 + 11 = 4987. The converter uses BigInt, so the displayed result does not lose precision for large integers.

Practical notes

Why hex is useful in programming

Hexadecimal is a compact way to read binary data because every hex digit corresponds to four bits. Two hex digits fit into one byte, making values such as FF, 80 and 00 easier to scan than eight binary digits. A programming language may write the same value with a `0x` prefix, such as `0xFF`; RadixLab returns bare uppercase digits so the result is easy to reuse in different contexts.

This page converts integers only. It does not interpret decimal fractions, signed two’s-complement values or CSS color syntax as separate formats. Choose Hex input when the value you already have is written in base 16.

  • Remainders 0–9 stay as digits.
  • Remainders 10–15 become A, B, C, D, E and F.
  • Read the final remainder list from right to left to form the result.

Quick reference

Examples

42

2A

42 in base 16

255

FF

15 × 16 + 15

4987

137B

Remainders read upward

Common questions

FAQ

What is 42 in hexadecimal?

42 in decimal is 2A in hexadecimal.

Why does hexadecimal use letters?

Base 16 needs sixteen symbols, so A through F represent values 10 through 15.

Does the converter add a 0x prefix?

No. The result is shown as uppercase hexadecimal digits; you can add 0x when a programming language or tool requires it.

How do I convert 255 from decimal to hex?

255 divided by 16 is 15 remainder 15. Both remainders map to F, so 255 is FF in hexadecimal.

Why are hexadecimal digits A through F?

Base 16 needs sixteen symbols. The digits 0–9 represent values 0–9, and A–F represent values 10–15.