Hexadecimal ↔ Decimal Converter

Convert between hexadecimal (base-16) and decimal (base-10) number systems instantly. Essential tool for programmers, web developers, and anyone working with color codes, memory addresses, or low-level programming.

Base 16 ↔ Base 10
Programming Tool
Computer Science
Web Development

Hexadecimal ↔ Decimal Converter

Convert between hexadecimal (base-16) and decimal (base-10) number systems

Use digits 0-9 and letters A-F. Optional 0x prefix accepted.

Quick Examples

Hexadecimal Reference

Hex Digits

0 = 0
1 = 1
2 = 2
3 = 3
4 = 4
5 = 5
6 = 6
7 = 7
8 = 8
9 = 9
A = 10
B = 11
C = 12
D = 13
E = 14
F = 15

Powers of 16

16⁰ = 1
16¹ = 16
16² = 256
16³ = 4,096
16⁴ = 65,536
16⁵ = 1,048,576

How to Use the Hexadecimal Converter

Master hex-decimal conversion with our comprehensive guide

1Choose Conversion Direction

Select whether you want to convert:

  • Hex to Decimal: Convert base-16 to base-10
  • Decimal to Hex: Convert base-10 to base-16
  • Both directions: See both representations
  • Real-time: Conversion happens as you type

2Enter Your Number

Input the number in the appropriate format:

  • Hexadecimal: Use digits 0-9 and letters A-F
  • Decimal: Standard base-10 numbers
  • With/without prefix: 0x optional for hex
  • Case insensitive: A-F or a-f both work

3View Results

See the conversion with detailed breakdown:

Hex: FF → Decimal: 255
Breakdown: (15×16¹) + (15×16⁰) = 240 + 15 = 255

4Copy and Apply

Use the converted values in your projects:

  • • Copy hex values for CSS color codes
  • • Use decimal values for programming calculations
  • • Apply in memory address calculations

Understanding Hexadecimal Numbers

Learn the fundamentals of base-16 number system

Hexadecimal is a base-16 number system that uses sixteen distinct symbols: 0-9 to represent values zero to nine, and A-F (or a-f) to represent values ten to fifteen. Each position represents a power of 16, making it extremely useful in computing and digital systems.

Hexadecimal Digits

0 = 0
4 = 4
8 = 8
C = 12
1 = 1
5 = 5
9 = 9
D = 13
2 = 2
6 = 6
A = 10
E = 14
3 = 3
7 = 7
B = 11
F = 15

Position Values

16³ (4096s place)×4096
16² (256s place)×256
16¹ (16s place)×16
16⁰ (1s place)×1

Conversion Examples & Practice

Step-by-step examples to master hex-decimal conversion

Hex to Decimal Examples

Example 1: Simple Conversion

Hex: A
Step 1: A = 10 in decimal
Result: 10

Example 2: Two Digits

Hex: 2F
Step 1: 2 × 16¹ = 2 × 16 = 32
Step 2: F × 16⁰ = 15 × 1 = 15
Step 3: 32 + 15 = 47
Result: 47

Example 3: Larger Number

Hex: 1A3
Step 1: 1 × 16² = 1 × 256 = 256
Step 2: A × 16¹ = 10 × 16 = 160
Step 3: 3 × 16⁰ = 3 × 1 = 3
Step 4: 256 + 160 + 3 = 419
Result: 419

Decimal to Hex Examples

Example 1: Division Method

Decimal: 255
255 ÷ 16 = 15 remainder 15 (F)
15 ÷ 16 = 0 remainder 15 (F)
Read remainders bottom to top
Result: FF

Example 2: Larger Number

Decimal: 1000
1000 ÷ 16 = 62 remainder 8
62 ÷ 16 = 3 remainder 14 (E)
3 ÷ 16 = 0 remainder 3
Read remainders: 3E8
Result: 3E8

Example 3: Powers of 16

16¹ = 16 → 10
16² = 256 → 100
16³ = 4096 → 1000
16⁴ = 65536 → 10000

Real-World Applications

Discover how hexadecimal is used across different fields

Web Development

CSS color codes use hexadecimal format. #FF0000 represents pure red, #00FF00 is green, and #0000FF is blue. Understanding hex makes color manipulation much easier.

#FF5733 → Red: 255, Green: 87, Blue: 51

Memory Addresses

Computer memory addresses are typically displayed in hexadecimal. It's more compact than decimal and aligns with byte boundaries, making debugging and low-level programming easier.

0x7FFF5FBF → Memory address in hex format

Programming

Hexadecimal is used for bit manipulation, color values, Unicode characters, and representing binary data in a more readable format. Essential for systems programming.

0x1F → Binary: 00011111 (5 bits set)

Cryptography

Hash functions, encryption keys, and digital signatures are often represented in hexadecimal format. It provides a readable way to display binary cryptographic data.

SHA-256: A1B2C3D4... (hex representation)

File Formats

Many file formats use hexadecimal values for headers, metadata, and binary data representation. Hex editors display file contents in hexadecimal for analysis.

PNG header: 89 50 4E 47 0D 0A 1A 0A

Hardware Design

Digital circuit design, microcontroller programming, and hardware debugging often use hexadecimal for register values, instruction codes, and configuration settings.

Register 0x40: Value 0xA5 (configuration)

Frequently Asked Questions

Common questions about hexadecimal number conversion

Why is hexadecimal used in computing?

Hexadecimal provides a compact way to represent binary data. Each hex digit represents exactly 4 binary digits (bits), making it much more readable than long binary strings. It's also aligned with byte boundaries (8 bits = 2 hex digits), which is fundamental to computer architecture.

What's the largest hex number this converter can handle?

Our converter can handle very large hexadecimal numbers, limited mainly by JavaScript's number precision (up to about 15-16 significant digits). For most programming and web development tasks, this range is more than sufficient. For cryptographic applications requiring larger numbers, specialized libraries would be needed.

Do I need the "0x" prefix for hexadecimal numbers?

No, the "0x" prefix is optional in our converter. It's commonly used in programming languages to indicate hexadecimal numbers (like 0xFF for 255), but our tool recognizes hex numbers with or without this prefix. The converter will automatically detect the format.

How do hex color codes work?

Hex color codes use 6 hexadecimal digits: two for red, two for green, and two for blue (RGB). For example, #FF0000 is pure red (FF=255 for red, 00=0 for green and blue). Each color component ranges from 00 (0) to FF (255), giving 16.7 million possible colors.

Can I convert negative numbers to hexadecimal?

Hexadecimal representation of negative numbers depends on the context. In programming, negative numbers are often represented using two's complement notation with a fixed bit width. Our basic converter handles positive integers. For negative numbers, you'd typically work with the absolute value and handle the sign separately.

What's the relationship between hex and binary?

Hexadecimal and binary have a direct relationship: each hex digit represents exactly 4 binary digits. For example, hex F equals binary 1111, hex A equals binary 1010. This makes hex an excellent shorthand for binary numbers, which is why it's so popular in programming and computer science.

Need to work with other number systems? Try our related tools: