Interactive Tool

Hex to Decimal Converter

Convert hex to decimal, decimal to hex, or either one to binary, and see every step: the powers of 16 behind each digit, the divide-by-16 remainders and the four-bit swap.

  • 3 number bases
  • 16 hex digits at most

Convert a Number

Convert from

0 to 9 and A to F, up to 16 digits. A 0x or # prefix and spaces are fine.

Conversion of hexadecimal 1A3
Hexadecimal (input)1A3 3 digits
Decimal419
Binary0001 1010 0011 9 bits, padded with leading zeros
In bytes01 A3 2 bytes

How it works

Place values (powers of 16)

DigitValuePlaceAdds
11× 162 = 256256
A10× 161 = 16160
33× 160 = 13

256 + 160 + 3 = 419

Swap each hex digit for four bits

10001A101030011

Converting an IP address? Use the binary converter

This hex to decimal converter works in every direction between hexadecimal, decimal and binary, and it shows the working, not just the answer. Choose what you’re converting from, type the value, and the panel gives you the other two forms plus the number split into bytes. Underneath, it shows how it got there: a powers-of-16 table for hex, the divide-by-16 remainders for decimal, and the four-bit groups that link hex to binary. It takes whole numbers up to 16 hex digits (64 bits), and it accepts a 0x or # prefix.

How to Convert Hex to Decimal

Hexadecimal is base 16. It counts 0 through 9 like decimal, then uses the letters A through F for ten through fifteen. Each position is worth 16 times the one to its right, so reading from the right the places are 1, 16, 256 and 4,096.

To convert, multiply each digit’s value by its place and add the results. Take 1A3:

  • 1 is in the 256s place, so it adds 1 × 256 = 256
  • A is ten, in the 16s place, so it adds 10 × 16 = 160
  • 3 is in the 1s place, so it adds 3

The total is 256 + 160 + 3 = 419. That’s the converter’s default example, and its place-value table lists those three rows.

The only part that takes practice is the letters. A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15. The chart below the converter lists all sixteen digits with their decimal and binary values. Once you know those by sight, most conversions are a couple of multiplications.

How to Convert Decimal to Hex

Use the divide-by-16 method. Divide the number by 16 and write down the remainder, then divide the quotient by 16 again. Keep going until the quotient is 0. Each remainder is one hex digit, and a remainder from 10 to 15 becomes a letter. Read the digits from the last remainder back up to the first.

For 500:

  • 500 ÷ 16 = 31, remainder 4
  • 31 ÷ 16 = 1, remainder 15, which is F
  • 1 ÷ 16 = 0, remainder 1

Reading upward gives 1F4. Check it by converting back: 1 × 256 + 15 × 16 + 4 = 256 + 240 + 4 = 500. Choose Decimal in the converter and it builds this table for any number, with the hex digit for each remainder in its own column.

For small numbers there’s a shortcut. Below 256 the answer is always two digits, so divide once: the quotient is the first digit and the remainder is the second. For 200, that’s 12 remainder 8, so the answer is C8.

Hex to Binary and Binary to Hex

This is the conversion that makes hex worth learning. Each hex digit stands for exactly four bits, a group called a nibble, so you can swap digit for digit with no arithmetic at all.

For 1A3, swap each digit for its four bits:

  • 1 is 0001
  • A is 1010
  • 3 is 0011

So 1A3 in binary is 0001 1010 0011. Drop the leading zeros if you like, since they don’t change the value.

Going the other way, split the binary into groups of four starting from the right, and pad the leftmost group with zeros if it comes up short. Then swap each group for its hex digit. Choose Binary in the converter to see this grouping. It’s the same swap in reverse, and it’s why a byte (eight bits) is always exactly two hex digits.

Where You’ll See Hex in IT

Hex shows up anywhere there are too many bits to write out comfortably.

MAC addresses. A MAC address is a 48-bit identifier for a network interface. RFC 7042 writes it as six octets, each one two hex digits, separated by hyphens, as in 00-00-5E-00-53-01, one of the values that RFC reserves for documentation. The first three octets are the OUI, which identifies the organization that assigned the address. Some systems use colons instead of hyphens, but the digits mean the same thing.

IPv6 addresses. An IPv6 address is 128 bits. RFC 4291 writes it as eight groups of up to four hex digits separated by colons, and each group stands for 16 bits. The largest group, FFFF, is 65,535 in decimal. Reading IPv6 prefixes is mostly a matter of turning hex groups into bits, which is the nibble swap above.

Web colors. CSS writes a color as # followed by hex digits. In the six-digit form, the CSS Color Module Level 4 specification reads the three pairs as red, green and blue, where 00 is none of that color and FF is the most. So #00FF00 is pure green, and each pair runs from 0 to 255 in decimal. Paste a color into the converter with its # and you’ll get the number behind it.

Raw bytes. Packet captures, memory dumps, file signatures and error codes tend to show data as pairs of hex digits, one pair per byte. The converter’s In bytes row splits any number the same way.

If you’re working toward networking certifications like CompTIA Network+ or the Cisco CCNA, MAC addresses and IPv6 are where hex stops being an abstract exercise. For binary and IPv4 octets, the binary converter shows the place values for any number or address, and the subnet calculator works out a whole network from an address and mask.

Hex to Decimal and Binary Chart

All sixteen hex digits with their decimal and four-bit binary values. Swap digit for nibble and you have converted hex to binary.

HexDecimalBinary
000000
110001
220010
330011
440100
550101
660110
770111
881000
991001
A101010
B111011
C121100
D131101
E141110
F151111

Powers of 16 Table

The place values of hexadecimal: each one is 16 times the last, and each hex digit adds four bits.

PowerValueHexBits
160110
16116104
1622561008
1634,096100012
16465,5361000016
1651,048,57610000020
16616,777,216100000024
167268,435,4561000000028
1684,294,967,29610000000032

Hex Converter FAQ

What is FF in decimal?

FF is 255. The first F sits in the 16s place and is worth 15 × 16 = 240, and the second F is worth 15, so 240 + 15 = 255. Two hex digits make one byte, and 255 is the largest number a byte can hold, which is why FF shows up wherever a byte is maxed out.

How many hex digits are in a MAC address?

Twelve. A MAC address is 48 bits, and RFC 7042 writes each of its six octets as two hex digits separated by hyphens, as in 00-00-5E-00-53-01. The first three octets identify the organization that assigned the address.

What does 0x mean before a number?

It marks the number as hexadecimal, so 0x10 means sixteen and not ten. The prefix isn't part of the value. You'll also see a # in front of CSS colors and an h after the number in some assembly code. The converter accepts 0x and # and ignores them.

Why do computers use hex instead of binary?

They don't, internally: the hardware works in binary. Hex is for people. Each hex digit stands for exactly four bits, so a long run of 0s and 1s shrinks to a quarter of its length and converts back without any arithmetic. A 32-bit value is eight hex digits instead of 32 bits.

Does the converter save what I type?

No. The conversion runs in your browser and nothing you type is saved. When you press Convert or leave the field, your input is added to the page address so you can share the result, and like any page address it can appear in the site's analytics, as the privacy policy describes.

Keep researching

Sources

  1. RFC 4291, IP Version 6 Addressing Architecture
  2. RFC 7042, IANA Considerations and IETF Protocol and Documentation Usage for IEEE 802 Parameters
  3. CSS Color Module Level 4

Sponsored

Online IT & Cybersecurity Programs

Schools pay to appear in these listings. They are separate from our rankings, which no school can pay to change.