Encoding desk

Decimal to Hex

Convert a signed decimal integer to uppercase hexadecimal exactly.

Decimal to Hex: Write a decimal whole number in uppercase hexadecimal. Decimal to Hex returns the numeric digits without a 0x prefix, byte separators or a selected storage width. Use the result as a starting point for a constant, then add the formatting required by your destination. Runs 100% locally in your browser with zero server file uploads.

Runs
In your browser
Cost
Free · no sign-up
Availability
Ready to use
Decimal → Hex / local workbenchLocal processing

Runs entirely in your browser

256 character input · 1,024 character output

Result

Ready

Conversions run locally. Numeric values are integers, signs are normalized, and prefixes such as 0b or 0o are intentionally not accepted.

Remainders in base sixteen

For magnitude q, calculate quotient q_next = floor(q / 16) and digit r = q − 16×q_next, mapping remainders 10–15 to A–F. Read successive remainders backwards. Input 43981 gives 43981 = 16×2748 + 13 (D); 2748 = 16×171 + 12 (C); 171 = 16×10 + 11 (B); 10 = 16×0 + 10 (A). The result is ABCD. Verification: 10×4096 + 11×256 + 12×16 + 13 = 43981.

Prefixes, bytes and exactness

Hexadecimal notation represents a magnitude independently of memory layout. Cornell’s byte-order description (https://www.cs.cornell.edu/courses/cs3110/2020sp/manual-4.8/libref/Bytes.html) explains why sending that magnitude as bytes needs an endianness convention. The input limit is 256 characters including an optional sign, and the output ceiling is 1,024. Fractions, commas, spaces and exponent notation fail validation. Exact integer arithmetic allows results beyond JavaScript Number’s safe range of ±9,007,199,254,740,991 (https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-number.max_safe_integer). Exporting through floating-point software can still round them; retain the hex text for exact comparison.

How to use it

  1. Enter the value in the format shown below.
  2. Run the conversion and check the result against your source convention.
  3. Copy or download the output in the form required by your destination.

Privacy & limitations

Conversion runs in your browser. Your values and results are not uploaded.

Related tools

Frequently asked questions

How do I turn the result into a byte field?

Pad positive values to an even digit count before splitting into pairs. Decimal 10 becomes A here and needs 0A for a single byte. A two-byte field may need 000A. Check the maximum value first; padding changes presentation but cannot make an oversized value fit.

Can I send the hex result straight to a little-endian device?

Only after arranging bytes for that protocol. Decimal 4660 becomes 1234, whose two bytes are 12 and 34. A little-endian field sends 34 before 12. Reverse byte pairs after padding to the specified width; reversing the four characters would produce a different number.

Does a negative input return its machine representation?

It returns a minus sign followed by the hex magnitude. For an eight-bit signed field, −1 needs the two’s-complement pattern FF; calculate 256 − 1 = 255 first and convert that positive value. This tool neither chooses a width nor silently masks bits that exceed one.

Free tool · runs in your browser · no account required