Ekuation

conversion

Hex to Decimal Converter

Convert hexadecimal to decimal. Perfect for color codes, memory addresses, and debugging register values.

Back to Number Base Converter

Enter a hex number (0-9, A-F). Case-insensitive. Accepts 0x prefix.

Maximum fractional digits for non-terminating expansions.

Number Base Conversion Tips

Click to show tips

Try an Example

Pick a scenario to see how the calculator works, then adjust the values

ASCII Letter A

Convert the ASCII code for uppercase A (65) across all bases.

Key values: Decimal 65 · Binary 1000001 · Hex 41

Byte Maximum

The largest value a single byte can hold (255).

Key values: Decimal 255 · Binary 11111111 · Hex FF

Hex Color Code

Convert a common hex color code (deep sky blue) to other bases.

Key values: Hex 00BFFF · Decimal 49151 · Binary nibbles

Documentation

The Hexadecimal System

Hexadecimal (base-16) uses sixteen digits: 0–9 for values 0–9 and A–F for values 10–15:

Hex0123456789ABCDEF
Dec0123456789101112131415

Hex is case-insensitive: 3F and 3f are the same value.


Conversion Method

Multiply each hex digit by its positional power of 16 and sum:

(hnhn1h1h0)16=i=0nhi×16i(h_n h_{n-1} \ldots h_1 h_0)_{16} = \sum_{i=0}^{n} h_i \times 16^i

Worked Example

Convert 2AF16\text{2AF}_{16} to decimal:

2×162+10×161+15×160=512+160+15=6872 \times 16^2 + 10 \times 16^1 + 15 \times 16^0 = 512 + 160 + 15 = 687

Hex in Web Colors

CSS colors use hex notation: #RRGGBB, where each pair is a hex value from 00 (0) to FF (255):

ColorHexRGB Decimal
Red#FF0000(255, 0, 0)
Green#00FF00(0, 255, 0)
Blue#0000FF(0, 0, 255)
White#FFFFFF(255, 255, 255)
Steel Blue#4682B4(70, 130, 180)

Why hex for colors? Each RGB channel is one byte (0–255), which maps perfectly to two hex digits (00–FF). This makes hex the most compact human-readable notation for 24-bit color values.


Hex Notation Conventions

  • 0x prefix — C, C++, JavaScript, Python: 0x2AF
  • # prefix — CSS colors: #2AF or #0022AAFF
  • $ prefix — Assembly, Pascal: $2AF
  • h suffix — Intel assembly: 2AFh
  • U+ prefix — Unicode code points: U+0041 (letter A)

Frequently Asked Questions

How do you convert hexadecimal to decimal?

Multiply each hex digit by its positional power of 16 and sum. For hex digits A–F, use their decimal values 10–15. For example, 2AF=2×162+10×161+15×160=512+160+15=687\text{2AF} = 2 \times 16^2 + 10 \times 16^1 + 15 \times 16^0 = 512 + 160 + 15 = 687.

Is hexadecimal case-sensitive?

No. Both uppercase (A–F) and lowercase (a–f) represent the same values. Convention is to use uppercase in output, but inputs are accepted in either case.

Why is hex used for CSS color codes?

Each RGB color channel is one byte (0–255), which maps perfectly to two hex digits (00–FF). This makes hex the most compact human-readable notation for 24-bit color values. For example, #FF5733 means R=255, G=87, B=51.

What does the 0x prefix mean before hex numbers?

The 0x prefix is a programming convention used in C, JavaScript, Python, and many other languages to indicate that the following digits are hexadecimal, not decimal. Other conventions include # (CSS), $ (assembly), and U+ (Unicode).

What is the decimal value of FF in hex?

FF in hex equals 15×16+15=25515 \times 16 + 15 = 255 in decimal. This is the maximum value of a single byte (8 bits all set to 1), which is why it appears as the maximum for each RGB color channel.

Related conversion Variants

Explore more conversion options

More Math Calculators

Explore the category

Calculator Search

Search and find calculators