Skip to content
Sealpaste

Delete all recent work?

This removes the 0 items saved in this browser. Your settings stay.

Stop saving recent work?

New work won't be saved in this browser. The 0 items already saved can stay or go.

Decimal to Hex

Ready
Runs in your browser. Nothing you paste is uploaded unless you share it.

Convert decimal to hexadecimal, exact for big numbers, with the divide-by-16 steps

Type a decimal number and read it in hex, with the divide-by-16 steps written out, capitals if you like, and negative numbers as the hex a computer stores.

How to use it

  1. Type a whole number or a decimal fraction.
  2. Read the hex on top and the division by 16 under it; ff or FF picks the letters.
  3. For a negative number, pick the width in Bits: -1 is ff in 8 bits and ffffffff in 32.

Examples

A whole number

Input
48879
Result
beef

48879 ÷ 16 = 3054 remainder 15 (f), 3054 ÷ 16 = 190 remainder 14 (e), 190 ÷ 16 = 11 remainder 14 (e), 11 ÷ 16 = 0 remainder 11 (b)

A negative number in 32 bits

Input
-2
Result
FFFFFFFE

Bits: 32, FF.

How to convert decimal to hex by hand

Divide by 16 and write down the remainder as a hex digit (10 to 15 are a to f), then divide the quotient again until it reaches 0. Read the remainders from the last one up.

Values worth knowing

DecimalHexWhat it is
255ffthe largest byte
65,535ffffthe largest 16-bit value
2,147,483,6477fffffffthe largest signed 32-bit integer
4,294,967,295ffffffffthe largest unsigned 32-bit integer
9,007,199,254,740,9911fffffffffffffthe largest integer a JavaScript number holds exactly

Questions

Should hex be written in capitals?
Either is the same value. Capitals are common in memory dumps and color codes, small letters in hashes and in most code. Pick ff or FF; Copy takes the letters as shown.
How is a negative number written in hex?
As the hex of its two’s complement bits at a fixed width: -1 is ff in 8 bits, ffff in 16 and ffffffff in 32. Pick the width in Bits; the Hex row under it is the value a program at that width stores.
What are the big-endian and little-endian rows?
The bytes as memory holds them from the lowest address. 0x12345678 as 32-bit is 12 34 56 78 big-endian (network order) and 78 56 34 12 little-endian, the order x86 and most ARM computers use. They show from 16 bits up.
Is the number I type uploaded?
No. Everything runs in your browser, so your numbers stay on your device. Nothing you paste is uploaded unless you share it.

Related tools