Decimal to Hex Converter

Hex shows up every time you touch colors, memory addresses, Unicode code points or file checksums. This converter takes a decimal integer and returns its base-16 representation instantly, in uppercase. Negative numbers come out as 64-bit two’s complement, the form compilers and debuggers use.

How to convert decimal to hex

  1. 1

    Enter a decimal integer

    Type a positive or negative whole number, up to the 64-bit range. Fractional parts are ignored, so enter only what you want converted.

  2. 2

    Read the hex output

    The uppercase hexadecimal value appears instantly. No prefix is added; the tool outputs the bare digits.

  3. 3

    Check negative values

    Negative integers come out as 64-bit two's complement, so -1 becomes FFFFFFFFFFFFFFFF, the pattern a 64-bit register stores.

  4. 4

    Use the result

    Copy the value into your code, config file or terminal, adding 0x yourself where the target language requires it.

How base-16 works

Hexadecimal uses digits 0-9 and letters A-F, where A equals 10, B equals 11, up to F equals 15. Each hex digit encodes exactly four bits, which is why hex is the natural companion to binary for programmers: one hex character replaces four binary digits with no loss.

Common conversion landmarks

Decimal Hex Notes
10 A First digit that uses a letter
16 10 Place value wraps after F
255 FF Max value of one unsigned byte
256 100 First value that needs three digits
4,095 FFF Max 12-bit unsigned
65,535 FFFF Max value of two bytes
16,777,215 FFFFFF Max RGB color value

Negative integers and two’s complement

Negative inputs are converted to 64-bit two’s complement, the bit pattern a 64-bit register actually holds. Enter -1 and you get FFFFFFFFFFFFFFFF; -42 becomes FFFFFFFFFFFFFFD6. The tool reports the raw bit pattern, not an algebraic form such as -2A, so compare with what the system you are feeding expects.

Tips

  • Color codes need 6 hex digits. A CSS hex color is three bytes (6 digits), one per RGB channel. The converter returns FF for 255; add the missing zeros yourself when you build a color such as 0000FF.
  • Memory addresses use 0x. The 0x prefix signals “what follows is hex” in C, Python, JavaScript and most disassemblers. This converter does not add it; type it yourself when the target language requires it.
  • Case does not change the value. 0xFF and 0xff are identical. This converter always outputs uppercase.

Frequently Asked Questions

The converter works with whole numbers only. A value like 3.14 is truncated to 3 before conversion. Remove the fractional part first, or use a tool that handles hex fractions.

It is a syntactic marker introduced by the C language so the parser knows the digits that follow are base 16. Without it, 10 could be base 10, 2, 8 or 16; with 0x10 it is unambiguously 16 decimal. This converter does not accept 0x input, so type the plain digits.

Negative integers are shown as 64-bit two’s complement, the pattern a 64-bit register stores. -1 becomes FFFFFFFFFFFFFFFF rather than -1, because that is the value your computer actually holds.

The number you enter is sent to the calculator each time you type so it can compute the hex value. It is not stored after you close the page and it is never shared.

Related Tools

Tool available in other languages