Hexadecimal Arithmetic Calculator
Hex / Decimal / Binary Converter
RGB to Hex Colour Converter
Enter RGB values (0–255 each) to get the hex colour code — or enter a hex code to convert to RGB.
What Is Hexadecimal?
Hexadecimal is a base-16 number system. It uses 16 symbols: the digits 0–9 and the letters A–F (where A=10, B=11, C=12, D=13, E=14, F=15).
| Decimal | Hex | Binary | Decimal | Hex | Binary |
|---|
The key insight is that one hex digit = four binary bits. This makes hex a compact and human-readable shorthand for binary. A byte (8 bits) is always exactly two hex digits (00 to FF).
How to Convert Hex to Decimal
Multiply each hex digit by 16 raised to its positional power (rightmost position = 0), then sum the results:
2 × 16² = 2 × 256 = 512
A × 16¹ = 10 × 16 = 160
F × 16⁰ = 15 × 1 = 15
512 + 160 + 15 = 687
Hexadecimal Arithmetic — Carrying at 16
Hex arithmetic works exactly like decimal arithmetic, but you carry when a column sum reaches 16 (not 10):
F + E = 15 + 14 = 29
29 = 1 × 16 + 13 → write D, carry 1
2 + 1 + (carry 1) = 4
Result: 4D
F + 1 = 10 (carry!)
9 + 9 = 12
F + F = 1E
A + 6 = 10 (carry!)
Hex Colour Codes in CSS and HTML
Web colours are specified as six hex digits in the format #RRGGBB, where each pair represents the red, green, and blue channels on a scale of 00 (0) to FF (255):
- #FF0000 = Red (R=255, G=0, B=0)
- #00FF00 = Lime green (R=0, G=255, B=0)
- #0000FF = Blue (R=0, G=0, B=255)
- #FFFFFF = White (R=255, G=255, B=255)
- #000000 = Black (R=0, G=0, B=0)
- #FF5733 = Custom orange (R=255, G=87, B=51)
With 256 levels per channel, there are 256³ = 16,777,216 possible colours — over 16 million. Shorthand 3-digit codes (#F00) expand to 6 digits by doubling each digit (#FF0000).
Hex in Computer Memory Addresses
Computer memory is byte-addressable, and memory addresses are displayed in hex because it is compact and maps cleanly to binary. Examples:
- 0x00000000 — start of memory (null pointer)
- 0x7FFFFFFF — 2GB boundary (common 32-bit user space limit)
- 0xFFFFFFFF — maximum 32-bit address (4GB)
The 0x prefix is the convention in C, C++, Python, and many other languages to indicate a hexadecimal literal. In assembly language and many debugging tools, hex is the standard for addresses, opcodes, and raw data.
Hex, Decimal, Binary Table: 0–255 (Selected Values)
| Decimal | Hex | Binary | Decimal | Hex | Binary |
|---|
How to Convert Hex
This converter provides instant, accurate results for your measurement conversions. The UK uses a mix of metric and imperial measurements in daily life, which can make conversions a frequent necessity. Road signs use miles, food is sold in grams and kilograms, and height is often quoted in feet and inches despite the metric system being the official standard.
Understanding the conversion formula helps verify results and perform quick mental calculations when a tool is not available.
Key Information
Common UK conversion factors: 1 inch = 2.54 cm, 1 foot = 30.48 cm, 1 mile = 1.609 km, 1 pound (lb) = 0.4536 kg, 1 stone = 6.35 kg, 1 pint (UK) = 568 ml, 1 gallon (UK) = 4.546 litres, 1 acre = 0.4047 hectares. Temperature conversions use the formula: Celsius = (Fahrenheit - 32) x 5/9.
Example Calculation
To convert 5 feet 10 inches to centimetres: first convert to total inches (5 x 12 + 10 = 70 inches), then multiply by 2.54 to get 177.8 cm. For weight, a person weighing 12 stone 7 lbs is 12.5 stone, which equals 79.4 kg (12.5 x 6.35).
Source: Based on international measurement standards. Last updated March 2026.
Frequently Asked Questions
What is hexadecimal and why is it used?
How do you convert hex to decimal?
How do you add hexadecimal numbers?
What do hex colour codes mean?
What is the difference between hex and binary?
How are hex numbers used in memory addresses?
Related Calculators
Official Sources
Data verified against official UK government sources. Last checked April 2026.