Decimal to Hex Converter

Convert a base-10 decimal number to base-16 hexadecimal. Enter a whole number to get the exact hex result, plus binary and octal equivalents.

Non-negative whole numbers only. Any number of digits is supported.

What is Decimal to Hex Conversion?

Decimal to hexadecimal conversion changes a base-10 number (digits 0-9) into its base-16 equivalent, which uses digits 0-9 plus letters A-F to represent values 10 through 15. Converting decimal to hex is the basis for reading memory addresses, color codes, and byte values in a compact form.

For example, decimal 255 is the largest value a single byte can hold, and it equals hexadecimal FF. To convert the other direction, use the Hex to Decimal Converter. For the related base-2 conversion, see Decimal to Binary.

How to Convert Decimal to Hex Manually

The standard manual method is repeated division by 16:

Division-by-16 method

  1. Step 1: Divide the decimal number by 16.
  2. Step 2: Record the remainder, converting it to a hex digit if it's 10 or higher (A=10, B=11, C=12, D=13, E=14, F=15).
  3. Step 3: Divide the quotient by 16 again.
  4. Step 4: Repeat until the quotient reaches 0.
  5. Step 5: Read the remainders in reverse order (bottom to top) — that is the hexadecimal result.

Worked example: convert 255 to hexadecimal

255 ÷ 16 = 15 remainder 15 (F)
 15 ÷ 16 = 0  remainder 15 (F)

Reading remainders from bottom to top: FF

Therefore, 255 in decimal = FF in hexadecimal

Manual division is useful for understanding the mechanics, but it is easy to drop a remainder on longer numbers — the converter above returns the exact result for any size of input. For a fuller walkthrough with more worked examples, see How to Convert Decimal to Hex.

Hex Digit Reference (0-9, A-F)

Hexadecimal is base 16, so each digit position can hold 16 possible values. Decimal 0-9 use the same digits in hex; decimal 10-15 use the letters A-F.

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

Decimal to Hex Conversion Table

A quick reference for common decimal numbers and their hexadecimal equivalent:

DecimalHexadecimal
00
11
99
10A
15F
1610
261A
311F
3220
422A
10064
255FF
256100
4095FFF

Where Decimal to Hex Conversion Is Used

  • Programming and debugging: memory dumps, pointers, and error codes are typically printed in hex because it maps cleanly onto bytes (2 hex digits = 1 byte).
  • Memory addresses: operating systems and debuggers display addresses in hexadecimal for compact, unambiguous reading.
  • Color and data representation: CSS/HTML color codes (such as #FF5733) are three hex byte pairs for red, green, and blue.
  • Low-level systems: MAC addresses, hash digests, and binary file dumps are conventionally shown in hex rather than binary or decimal.
  • Computer science education: converting between decimal, binary, and hex builds the base-conversion skills used throughout systems courses. The Decimal to Binary Converter covers the related base-2 case.

Negative Numbers and Two's Complement

This converter accepts zero and positive integers only. Simply writing a minus sign in front of a hex string (for example, -FF) isn't how computers represent negative numbers, and it isn't a fixed, unambiguous format on its own.

Machines represent negative numbers using two's complement, which requires choosing a fixed bit width (such as 8, 16, or 32 bits) before the hex representation makes sense. Use the Two's Complement Calculator to convert a negative decimal value into its signed representation at a specific bit width.

Frequently Asked Questions

How do I convert 255 to hex?

255 in decimal equals FF in hexadecimal. Dividing 255 by 16 repeatedly and reading the remainders bottom to top gives F then F.

What is the hex equivalent of 0?

0 in decimal is 0 in hexadecimal — it is the same value in every base.

Can I convert negative numbers to hex?

Not directly here. Negative numbers need a fixed bit width and a signed format such as two's complement — use the Two's Complement Calculator for that.

Why is hex used instead of decimal for things like colors and memory?

Hex aligns exactly with bytes: two hex digits represent one 8-bit byte (0-255), so values are more compact than decimal and far more compact than binary.

What is the largest decimal number this tool can convert?

There is no fixed size limit. Conversion uses BigInt arithmetic, so arbitrarily large integers convert exactly rather than losing precision — unlike JavaScript's native Number type, which becomes inexact beyond 2^53 - 1 (9,007,199,254,740,991).

Can I convert a decimal fraction like 10.5?

No — this converter handles whole numbers only. Enter the integer part; hexadecimal fractions use a different representation than integer conversion produces.

Is hexadecimal case-sensitive?

No. FF, ff, and Ff all represent the same value, 255 in decimal. This converter outputs uppercase letters for consistency.