Decimal to Hex Converter

Type a decimal number and read it in hexadecimal.

Runs entirely in your browser

Loading the tool…

Decimal—
Hexadecimal—
Octal—
Binary—
Base 32—
Base 36—
  • —Bits
  • —Bytes
  • —Fits in
  • —Parity

Any base from 2 to 36


  

Type a decimal number and read the hex. The box opens on 255, which is FF: the top of a single byte.

Going this direction is usually about making a number fit somewhere that expects hex: a colour channel, a bitmask, a byte you are about to write into a protocol. The figure worth checking is the width shown below the conversions, since a decimal number that looks modest can need more bytes than the field you are putting it in has.

The boundaries are the numbers to know: 255 is one byte, 65,535 is two, 16,777,215 is three, and 4,294,967,295 is four. Anything above one of those needs the next size up, and most of the surprises in this direction are a value that crossed a boundary without anybody noticing.

Binary and octal are converted at the same time, so this covers decimal to binary too. The other direction is hex to decimal.

How to use it

  1. Read the row you came for. Every base is converted at once.
  2. Type your own number into the box, which converts as you type.
  3. Use the custom base field for anything from 2 to 36.

Questions

How do I convert decimal to hex by hand?

Divide by sixteen repeatedly and read the remainders backwards, writing 10 to 15 as A to F. 255 divided by 16 is 15 remainder 15, so both digits are F. It is worth doing once to see why it works and then never again.

How many hex digits will my number need?

Two per byte. Up to 255 is one byte and two digits, up to 65,535 is two bytes and four digits, and so on. The width is shown under the conversions, which is the quickest way to check a value still fits the field you have.

Does it handle negative numbers and very large ones?

Negative numbers yes. Size is bounded by what the conversion can represent exactly, and a value beyond that is refused rather than silently rounded, since a base conversion that quietly loses the low digits is worse than no answer.

Is anything sent anywhere?

No. The conversion runs in WebAssembly in this tab and the page makes no request of its own, so it works with the network off and nothing you type is recorded.

Other conversions

The same converter opened on a different base. Every base is shown on each of them.

Your data stays on your device

Everything above runs inside your browser as WebAssembly compiled from Rust. Nothing you type is uploaded, logged or stored on a server. You can load this page once, go offline, and it still works.

This page makes no requests at all, to anywhere. That is not a promise in the copy: it is a Content-Security-Policy header your browser enforces, and connect-src on it is none. Open the network tab and watch nothing happen.