Decimal to Hexadecimal

Convert decimal to hexadecimal (decimal to hex) as you type, with every step shown. This free online converter gives exact results for numbers of any size, and also converts hexadecimal, binary and octal in any direction.

1 Enter your value

From
To

Examples

2 Your answer

Decimal

419dec

Show in other bases

Tap any value to copy it.

See the working

Guide

How it works

Three steps, whether you are reading a memory address, a bit flag or a byte value.

  1. 1

    Choose what to convert

    Pick what you have and what you want: decimal, hexadecimal, binary or octal.

  2. 2

    Type or paste a value

    Write it however you like: 65,535, 0xFF, FFh, with commas, spaces or underscores.

  3. 3

    Read the answer

    It appears as you type, in every other base, with the working shown.

The formulas

A digit's value depends on its position. Every answer here uses one of these rules:

Decimal to hexadecimal

divide by 16, keep the remainders

419 ÷ 16 = 26 r 3, 26 ÷ 16 = 1 r 10 (A), 1 ÷ 16 = 0 r 1, so 419 is 0x1A3.

Hexadecimal to decimal

decimal = Σ digit × 16position

0x1A3 is 1 × 256 + 10 × 16 + 3 × 1 = 419, so the answer checks out.

Hexadecimal to binary

each hexadecimal digit = 4 binary bits

0x1A3 is 1 → 0001, A → 1010, 3 → 0011, so 0x1A3 is 0001 1010 0011.

Decimal to hexadecimal digit chart

The decimal values 0 to 15 are the single hexadecimal digits 0 to F. Click one to add it to the converter.

All conversions

Decimal, hexadecimal, binary and octal converter

One free tool for every direction. Use it as a decimal to hexadecimal converter, convert decimal to binary or octal, or work backwards as a hexadecimal to decimal converter that turns 0x to decimal values. It also converts hexadecimal to binary, binary to hexadecimal and octal to decimal, so it works as a full number base converter and hexadecimal calculator. Pick a conversion to start.

About

Decimal to hexadecimal converter: fast, exact and explained

Hexadecimal numbers are everywhere in computing, from memory addresses and colour codes to error codes and file formats. This free decimal to hexadecimal converter turns any decimal number into its hexadecimal equivalent the moment you type it. It also converts hexadecimal to decimal, and handles binary and octal in any direction. Every result comes with the working, so you can see exactly how the answer was reached instead of just trusting it.

How to convert decimal to hexadecimal

Going from decimal to hexadecimal uses repeated division. Divide the number by 16 and note the remainder, then divide the quotient by 16 again until it reaches zero. Reading the remainders from bottom to top gives the hexadecimal value, with remainders of 10 to 15 written as the letters A to F. For example, 47 ÷ 16 = 2 remainder 15, and 2 ÷ 16 = 0 remainder 2, so 47 is 0x2F. The converter does this for you and lists every division in the “See the working” panel, so 419 turns into 0x1A3 in three clear lines.

Worked example: 419 to hexadecimal

419 ÷ 16 = 26  remainder 3
26 ÷ 16 = 1  remainder A
1 ÷ 16 = 0  remainder 1
Read bottom to top: 419 = 0x1A3

Decimal to hexadecimal conversion table

Use this decimal to hexadecimal table as a quick decimal to hexadecimal chart for common values, from 0 to 65,535.

DecimalHexadecimal
00
11
22
33
44
55
66
77
88
99
10A
11B
12C
13D
14E
15F
1610
3220
6440
10064
1277F
12880
255FF
256100
512200
1,0003E8
1,024400
4,0961000
65,535FFFF

How to convert hexadecimal to decimal

To go the other way, number the hexadecimal digits from the right starting at 0, multiply each digit by 16 raised to that position, and add the results. 0x1A3 becomes 1 × 256 + 10 × 16 + 3 = 419. Choose From Hexadecimal, To Decimal, or open the dedicated hexadecimal to decimal page, to see every step.

Binary and octal conversions

Each hexadecimal digit stands for exactly four binary bits, which is why programmers use hexadecimal as a compact way to write binary: 0xFF is 1111 1111. Octal groups bits in threes instead, so0o777 is 111 111 111, or 511 in decimal. You can convert decimal to binary or octal, convert binary to hexadecimal, and every answer is also shown in all four bases at once.

Who uses a decimal to hexadecimal converter?

Software developers turn decimal values into hexadecimal for memory addresses, bit masks, register values and error codes. Web designers convert RGB values such as 255, 128 and 0 into the hexadecimal colour#FF8000. Students meet hexadecimal in computer science, digital electronics and networking courses, where showing the working matters as much as the answer. Whatever the reason, typing a number and seeing the hexadecimal straight away saves time and avoids the small slips that come from dividing long numbers by hand.

Common decimal to hexadecimal values

A few values come up again and again. 255 is 0xFF, the largest single byte, and 256 is0x100. 65,535 is 0xFFFF, the largest 16-bit number, and 2,147,483,647 is0x7FFFFFFF, the largest signed 32-bit integer. Knowing these by heart makes it easier to spot limits and overflows in code.

Exact results for very large numbers

Many calculators lose precision with large numbers because they store values as floating point. This converter uses exact whole-number arithmetic, so 18,446,744,073,709,551,615 converts to0xFFFFFFFFFFFFFFFF with every digit correct. Negative numbers work too, and longer values, like 128-bit identifiers, convert the same way.

Free, private and simple

The decimal to hexadecimal converter is free and needs no sign-up or download. It works on phones, tablets and computers, accepts numbers with commas or spaces, and lets you paste values straight from code. All conversions run in your browser, so the numbers you type are never sent to a server.

Help

Questions

Quick answers to what people most often ask about hexadecimal, decimal and binary.

01How do I convert decimal to hexadecimal?

Divide the decimal number by 16 and write down the remainder. Keep dividing the quotient by 16 until it reaches 0. Read the remainders from bottom to top, writing 10–15 as A–F. For 419: 419 ÷ 16 = 26 r 3, 26 ÷ 16 = 1 r 10 (A), 1 ÷ 16 = 0 r 1, so 419 is 0x1A3. Open “See the working” under the answer to watch this for any number.

02What is 255 in hexadecimal?

255 is 0xFF in hexadecimal. 255 ÷ 16 = 15 remainder 15, and 15 is written as F, so the answer is FF. It is the largest value one byte can hold, which is why FF appears so often in colour codes, flags and network masks.

03What is 1024 in hexadecimal?

1,024 in decimal is 0x400 in hexadecimal.

04What is 10 in hexadecimal?

10 in decimal is 0xA in hexadecimal.

05What is 16 in hexadecimal?

16 in decimal is 0x10 in hexadecimal. That is why 0x10 means sixteen, not ten.

06What is 100 in hexadecimal?

100 in decimal is 0x64 in hexadecimal.

07Why does hexadecimal use the letters A to F?

Base 16 needs sixteen single-digit symbols, but there are only ten digits, 0 to 9. The letters A to F stand for 10 to 15, so A = 10 and F = 15, and 0xFF is 15 × 16 + 15 = 255.

08How do I convert decimal to hexadecimal in Excel?

Use the DEC2HEX function: =DEC2HEX(255) returns FF. It works the same way in Google Sheets. These functions only handle up to 10 result characters, and the binary ones only −512 to 511, so use this converter for larger numbers.

09How do I convert decimal to hexadecimal in Python or JavaScript?

In Python, hex(255) returns '0xff'. In JavaScript, (255).toString(16) returns 'ff'. Python handles any size; in JavaScript use BigInt for numbers above 2⁵³.

10Does the converter use two’s complement for negative numbers?

No. It keeps the minus sign, so −255 is −0xFF, −0b11111111 and −0o377. Computers usually store negative numbers in two’s complement, where the pattern depends on the width: −1 is 1111 1111 (0xFF) in 8 bits and 0xFFFF in 16 bits. To read a signed value whose top bit is set, subtract 2ⁿ: 0xFF as a signed 8-bit number is 255 − 256 = −1.

11Can I convert decimal numbers with a decimal point?

The converter works with whole numbers. By hand, convert the fractional part by multiplying it by the target base again and again and keeping the whole-number part each time. For example, 0.5 × 16 = 8, so 0.5 is 0x0.8 in hexadecimal, 0b0.1 in binary and 0o0.4 in octal.

12How many hexadecimal digits are in a byte?

Two. One hexadecimal digit is 4 bits, so a byte (8 bits) is two digits, from 00 to FF (0 to 255). A 16-bit number is 4 digits, a 32-bit number is 8 and a 64-bit number is 16.

13How do I convert RGB values to a hex colour code?

Convert each value from 0 to 255 into two hexadecimal digits and join them: rgb(255, 128, 0) is FF, 80 and 00, so the colour is #FF8000.

14Can I convert negative decimal numbers to hexadecimal?

Yes. Type a minus sign and the converter keeps it: −255 becomes −0xFF. Numbers of any size work, because the converter uses exact whole-number arithmetic.

15What does “dec to hex” mean?

“dec to hex” is short for decimal to hexadecimal, which means going from base 10 to base 16: a number written in base 10 is rewritten in base 16. For example, 255 becomes 0xFF.

16Does this decimal to hexadecimal calculator show the working?

Yes. It converts decimal to hexadecimal with steps: open “See the working” under the answer to see each division by 16 and the remainder it leaves. Every answer is also shown in decimal, hexadecimal, binary and octal at once.

17Is this decimal to hexadecimal converter free?

Yes. It is free with no sign-up, works online on phones, tablets and computers, and every decimal to hexadecimal conversion runs in your browser, so nothing you type is sent anywhere.

18What is hexadecimal?

Hexadecimal (often shortened to hex) is base 16. It uses the digits 0–9 and then the letters A–F for the values 10–15. Each place is worth 16 times the place to its right, the same way each decimal place is worth 10 times the one to its right.

19What does the 0x prefix mean?

It marks a number as hexadecimal, so 0x10 (sixteen) is not mistaken for 10 (ten). You will also see #FF8000 in CSS colours and 1A3h in some assembly languages. The converter shows hexadecimal results with 0x and accepts hexadecimal input with or without it.

20How do I convert hexadecimal to decimal?

Number the hexadecimal digits from the right, starting at 0. Multiply each digit by 16 to the power of its position, then add the results. For 0x1A3: 1 × 256 + 10 × 16 + 3 × 1 = 419. Choose From Hexadecimal, To Decimal above to see every step.

21How do I convert decimal to binary or octal?

Use the same repeated-division method, dividing by 2 for binary or by 8 for octal, and read the remainders from bottom to top. For example, 10 is 1010 in binary and 12 in octal. Choose From Decimal, then To Binary or To Octal, and the converter shows every step.

22How do I convert binary to hexadecimal?

Split the binary number into groups of four bits, starting from the right, then replace each group with its hexadecimal digit. For example, 1101 0110 becomes D6. Choose From Binary, To Hexadecimal and the converter does the grouping for you.