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
Type a whole number or a decimal fraction. Read the hex on top and the division by 16 under it; ff or FF picks the letters. 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
Values worth knowing
| Decimal | Hex | What it is |
|---|---|---|
255 | ff | the largest byte |
65,535 | ffff | the largest 16-bit value |
2,147,483,647 | 7fffffff | the largest signed 32-bit integer |
4,294,967,295 | ffffffff | the largest unsigned 32-bit integer |
9,007,199,254,740,991 | 1fffffffffffff | the 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.