Hexadecimal to Decimal Converter

Convert hexadecimal numbers to decimal (base 10) instantly. Supports 0x prefix and large numbers.

How to Convert Hex to Decimal

Each hexadecimal digit represents a power of 16. To convert:

  1. Identify each hex digit (0-9, A-F where A=10, F=15)
  2. Multiply each digit by 16^position (right to left, starting at 0)
  3. Sum all the results

Example: Convert 0xFF to decimal:

  • F (15) × 16¹ = 15 × 16 = 240
  • F (15) × 16⁰ = 15 × 1 = 15
  • Result: 240 + 15 = 255

Code Examples

const hex = "ff";
const decimal = parseInt(hex, 16); // 255
// For large numbers, use BigInt:
const bigHex = "ffffffffffffffff";
const bigDecimal = BigInt("0x" + bigHex);

Frequently Asked Questions

How do I convert hex to decimal?

Multiply each hex digit by its position value (16^n) and sum the results. For example, FF = (15 × 16¹) + (15 × 16⁰) = 240 + 15 = 255.

What does the 0x prefix mean?

The 0x prefix indicates a hexadecimal number in most programming languages (C, JavaScript, Python). It helps distinguish hex from decimal: 10 is ten, but 0x10 is sixteen.

Can I convert large hex numbers?

Yes! This converter supports arbitrarily large numbers using BigInt. It can handle hex values beyond the standard 64-bit integer limit.

Related Tools