Skip to content

Decimal to Hex Converter

Turn decimal integers into hexadecimal, with byte grouping, a 0x prefix and fixed-width two’s complement for negative values.

Processed locally in your browser

Options

Two’s complement writes a negative number as a fixed-width bit pattern (range −2^(N−1) … 2^N−1).

One number per line. Spaces and underscores inside a number are ignored.0 chars · 0 lines
The result will appear here.

What is Decimal to Hex Converter?

Hexadecimal uses sixteen digits (0-9 and A-F) and packs four bits into each character, which makes it the everyday notation for memory addresses, colours, byte values and hashes. Decimal 255 is FF and 4096 is 1000.

This converter handles integers of any size exactly. For negative numbers you can keep a minus sign or choose two’s complement at 8, 16, 32 or 64 bits, so −1 becomes FF, FFFF, FFFFFFFF or FFFFFFFFFFFFFFFF. Options add a 0x prefix, group digits by bytes or words, change letter case and pad to whole bytes.

How does it work?

  1. Paste one decimal integer per line.
  2. Choose how negative numbers are shown: minus sign or two’s complement width.
  3. Set the 0x prefix, uppercase, digit grouping and padding to 1, 2, 4 or 8 bytes.
  4. Copy the result; a single number also shows binary, octal and the byte count.

Common use cases

  • Converting decimal port, error or status codes to the hex values in documentation.
  • Writing colour channel values or offsets as hex literals in code and CSS.
  • Showing the hex bytes of a negative int32 as it is stored in memory.
  • Padding IDs or counters to fixed-width hex fields.

Examples

Try this input in the tool above:

Input
255
4096
-1
Output
FF
1000
-1

Privacy

Decimal to Hex Converter runs entirely in your browser. The text or files you provide are processed on your device and are not uploaded, logged or stored on our servers.

Limitations

Two’s complement modes require the number to fit the chosen width (−2^(N−1) up to 2^N−1). Fractions are not supported here; use the Base Converter for those.

Frequently asked questions

What is −1 in hexadecimal?

It depends on the width: FF in 8 bits, FFFF in 16, FFFFFFFF in 32. With a plain minus sign it is simply −1. Choose the two’s complement width you need.

How do I get 0x prefixes and uppercase?

Enable “Add 0x prefix” and “Uppercase A–F”. Both apply to every line of output.

Can I convert a huge number?

Yes. Any integer size converts exactly, for example 2^128 is 1 followed by 32 zeros in hex.

More tools in Developer Tools →