Shard Tools

Decimal to Hex

Convert a decimal number to hexadecimal in your browser, with full precision for large values.

Maintained by Roshan.

Use Decimal to Hex

Converts decimal number to hexadecimal in this tab, with nothing sent anywhere.

Runs entirely on your deviceThe conversion happens in this browser tab. Nothing you type is uploaded, logged or stored, which is worth knowing for anything you would not paste into a search box.

Explore developer and data tools

Find related browser-local tools for nearby tasks without starting another search.

Browse all developer and data tools

About Decimal to Hex

Converting a decimal number to hexadecimal is a daily task once you work near the machine, because hex is how memory addresses, colour values, permission masks and byte counts are conventionally written. The reason is that hex lines up neatly with bytes - every two digits is one byte - in a way decimal never does. Most calculators handle small numbers fine and quietly fail on large ones, because they convert through a floating-point number that loses precision once the value passes about nine quadrillion. That is not an exotic edge case: 64-bit identifiers, hashes and timestamps in nanoseconds all live above it. This tool works in arbitrary-precision integers throughout, so a value of any size converts exactly, digit for digit.

Using Decimal to Hex

  1. The number is read as an arbitrary-precision integer, so there is no ceiling above which precision is silently lost.
  2. It is converted to base sixteen by repeated division, the digits emerging from least to most significant and assembled in the correct order.
  3. The result uses digits 0 to 9 and letters a to f, the standard hexadecimal notation.
  4. Leading zeros, spaces and separators in the input are tolerated, so a value copied from anywhere works.
  5. Zero converts to zero, and the conversion is exact for a number of any length.

Where decimal to hex helps

Reading a byte count as hex

A file size or offset in decimal converts to the hex a debugger or hex editor would show, making the two views line up.

Working with a large identifier

A 64-bit ID converts exactly, where a calculator routing through floating point would round the last digits.

Before you use the result

Questions about Decimal to Hex

Does it handle numbers past 2^53?

Yes. It uses arbitrary-precision integers, so a 64-bit or larger value converts exactly rather than being rounded.

Why is hex useful?

Because two hex digits equal one byte, so memory addresses, colours and masks line up with the underlying bytes in a way decimal does not.

Can it convert fractions?

No. Only whole numbers. Hexadecimal fractions are rarely what is wanted.

Should the output have 0x?

It does not add one, since conventions vary. Prepend it yourself if needed.

Related tools

Hex to Decimal

Convert a hexadecimal number to decimal in your browser, with full precision for large values.

Decimal to Binary

Convert a decimal number to binary in your browser, with full precision for large values.

Text to Hex

Convert text to hexadecimal in your browser. Each character becomes its UTF-8 bytes in hex.