>_

Decimal to Hex

Type a decimal number below to get the hexadecimal value — other bases are shown too. The manual method is explained further down.

Try it

Custom base

Two’s complement

How to convert by hand

Divide by 16 repeatedly, note each remainder, then read the remainders from bottom to top:
255 ÷ 16 = 15 … F
15 ÷ 16 = 0 … F
→ FF

Reference table

Decimal → Hex

0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 A
11 B
12 C
13 D
14 E
15 F
16 10
32 20
64 40
100 64
127 7F
128 80
255 FF
256 100
1000 3E8
1024 400
4096 1000
65535 FFFF

In code

JavaScript

(255).toString(16).toUpperCase() // 'FF'

Python

format(255, 'X')  # 'FF'  (hex(255) → '0xff')

More examples

Open the full Number Base Converter →