Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Hexadecimal (Base 16)
FF
from decimal 255
Decimal input 255
Hex value FF
With 0x prefix 0xFF

What is a Decimal to Hex Converter?

This tool converts a number written in decimal (base 10, the everyday number system using digits 0-9) into hexadecimal (base 16, which uses digits 0-9 and letters A-F). Hexadecimal is widely used in computing for memory addresses, color codes, byte values and debugging because each hex digit represents exactly four binary bits.

How to Use It

Enter a whole decimal number — for example 255 — and the calculator returns the hexadecimal equivalent (FF), along with the conventional 0x-prefixed form (0xFF). Negative numbers are supported and shown with a leading minus sign.

The Formula Explained

Conversion uses repeated division by 16. Divide the number by 16, record the remainder, then repeat with the quotient until it reaches zero. Each remainder maps to a hex digit: 0-9 stay the same, while 10, 11, 12, 13, 14, 15 become A, B, C, D, E, F. The hex value is the remainders read in reverse order (last remainder first).

$$\text{Hex} = \left( \text{Decimal} \right)_{10} \rightarrow \left( \sum_{i=0}^{k} d_i \cdot 16^{\,i} \right)_{16}, \quad d_i = \left\lfloor \frac{|\text{Decimal}|}{16^{\,i}} \right\rfloor \bmod 16$$
Repeated division of a decimal number by 16 producing remainders that map to hex digits
Repeatedly dividing by 16; the remainders read bottom-up give the hex digits.

Worked Example

Convert 255: \(255 \div 16 = 15\) remainder 15 (F); \(15 \div 16 = 0\) remainder 15 (F). Reading bottom-up gives FF, or 0xFF. Convert 4096: \(4096 \div 16 = 256 \text{ r}0\), \(256 \div 16 = 16 \text{ r}0\), \(16 \div 16 = 1 \text{ r}0\), \(1 \div 16 = 0 \text{ r}1\), giving 1000.

Mapping of decimal values 10 through 15 to hex letters A through F
Decimal values 10–15 map to the hex letters A–F.

FAQ

Why are letters used in hex? Base 16 needs 16 distinct symbols. Since decimal only has 10 digits, the letters A-F fill in for the values 10 through 15.

What does the 0x prefix mean? It is a convention (used in C, Java, Python and many languages) that signals the following characters are a hexadecimal literal.

Can I convert decimals/fractions? This converter handles whole numbers; fractional parts are truncated before conversion.

Last updated: