Text & code / MULTIVERTO

Decimal to hexadecimal

Convert a whole decimal integer to hexadecimal notation with a 0x prefix.

Live converterYour input stays in this browser. No text is uploaded for conversion.
The file stays in your browser.
Chain tools

Apply each text tool to the previous result.

01 / Guide

How it works

Successive groups of four bits correspond to hexadecimal digits 0–9 and A–F.

Good to know

The sign is written separately; these results are not fixed-width two’s-complement machine integers.

02 / Example

Example

Your input255
Result0xFF

03 / Guide

Decimal to hexadecimal — How it works

Condensing an integer into hexadecimal

Convert a whole decimal integer to hexadecimal notation with a 0x prefix. Choose this direction to turn a decimal number from a log, calculator or API into the compact notation common in code and technical documentation. The output has a 0x prefix so readers can distinguish it from a decimal number that happens to contain the same digits. The tool accepts positive and negative whole integers of any practical length.

Successive groups of four bits correspond to hexadecimal digits 0–9 and A–F. Because sixteen equals two to the fourth power, each hex digit represents four binary bits. Decimal 255 becomes FF, written here as 0xFF; 15 becomes 0xF and 16 becomes 0x10. A negative result places the minus sign before 0x. The converter does not pad to byte boundaries or infer a color: 0xFF is a number, not automatically a CSS channel. For a concrete check, the example input 255 produces 0xFF. Keep the original beside the result when comparing it with another application.

What a number base changes

Decimal, binary and hexadecimal are different written forms of the same integer. Decimal has ten digits, binary has two, and hexadecimal has sixteen symbols, adding A through F after 0 through 9. The value itself does not change when its notation changes. A bit is a binary digit; four bits correspond to one hexadecimal digit, which makes hex compact for memory addresses, bit masks and debugging. Use these converters when a specification, log or programming language displays a number in a base other than the one you are reading.

Reading signs and widths correctly

The sign is written separately; these results are not fixed-width two’s-complement machine integers. These converters work with whole integers and retain arbitrary precision through BigInt, so a long value does not silently lose low bits as an ordinary floating-point number might. A leading minus sign represents a negative mathematical integer. It is not a fixed-width two’s-complement byte pattern: the bit string for minus one depends on whether a machine uses eight, sixteen, thirty-two or another number of bits. Add a width and encoding rule separately if a protocol requires one. Do not confuse the binary value of an integer with UTF-8 binary bytes of the characters used to spell it.

How this conversion transforms the input
Decimal integer
Positional digits
Hexadecimal integer