Hex Converter

Hex to decimal: FF = 15×16¹ + 15×16⁰ = 240 + 15 = 255. Decimal to hex: 12 = C, 255 = FF. Text: "Hi" = 48 69.

Prefixes 0x, 0b and 0o, spaces, underscores and a leading minus are accepted.

Did this solve your problem?
Prefer us on Google

How to use

  1. In Numbers mode, type a value into any of the four boxes. The other three update right away.
  2. You can paste values with a 0x, 0b or 0o prefix, with spaces or underscores, or with a leading minus sign.
  3. In Text mode, type words on top to see their UTF-8 bytes in hex, or paste hex bytes below to read the text.

How it works

Each digit in base b is worth b raised to its position. 0xFF is 15 × 16 + 15 = 255, and 0b1010 is 8 + 2 = 10.

The converter uses BigInt, so there is no 53-bit limit. A 40-digit hex value converts exactly instead of being rounded.

Text mode encodes characters as UTF-8. Letters in the basic Latin range take one byte, so "A" is 41. Accented letters take two bytes, most other scripts take three, and emoji take four, so "€" is E2 82 AC.

FAQ

How do I convert hex to decimal?

Type the hex value into the Hexadecimal box. The Decimal box shows the result straight away. For example, FF becomes 255 and 1A3F becomes 6719.

How do I convert decimal to hex?

Divide by 16 again and again and write down each remainder, using A to F for 10 to 15. Read the remainders from the last to the first. 300 ÷ 16 = 18 r 12 (C), 18 ÷ 16 = 1 r 2, 1 ÷ 16 = 0 r 1, so 300 is 12C.

What is 12 in hex?

12 in decimal is C in hex, because the hex digits A to F stand for 10 to 15. Going the other way, hex 12 is 1 × 16 + 2 = 18 in decimal.

How do I translate text to hex?

Switch to Text mode and type. Each character becomes its UTF-8 bytes, so "Hi" is 48 69. Paste hex bytes into the lower box to translate them back into text.

Does it handle negative numbers?

Yes, with a minus sign: -FF is -255. It shows signed values, not two's complement. For a fixed width such as 8 or 32 bits you would need to work out the complement yourself.

Why does my hex string show an error in text mode?

Text mode needs an even number of hex digits and bytes that form valid UTF-8. A lone byte such as FF is not valid text, so it is rejected instead of showing a garbled character.

Is there a size limit?

No fixed limit. Values with thousands of digits work, although very long numbers take a moment to convert on slow devices.