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.

Include the # symbol

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).

DecimalHexBinaryDecimalHexBinary

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:

Convert 2AF to decimal:
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):

Addition: 2F + 1E
F + E = 15 + 14 = 29
29 = 1 × 16 + 13 → write D, carry 1
2 + 1 + (carry 1) = 4
Result: 4D
Key hex sums:
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):

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:

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)

DecimalHexBinaryDecimalHexBinary

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?
Hexadecimal (base 16) uses 0–9 and A–F. It is used in computing because one hex digit represents exactly 4 bits, making it a compact and readable shorthand for binary. A byte (8 bits) is always exactly 2 hex digits. This makes hex ideal for colour codes, memory addresses, and machine code.
How do you convert hex to decimal?
Assign each hex digit its positional value (rightmost = 16⁰ = 1, next = 16¹ = 16, etc.). Multiply each digit by its positional value and sum. Example: 3E8 = (3×256)+(14×16)+(8×1) = 768+224+8 = 1000. Our calculator shows all steps.
How do you add hexadecimal numbers?
Add column by column right to left. Sum is carried when it reaches 16 (not 10). F+1=10 in hex (carry 1, write 0). 9+8=11 in hex (1×16+1=17, so write 1, carry 1). Practice: B+7=12 (11+7=18=1×16+2, so write 2, carry 1).
What do hex colour codes mean?
#RRGGBB specifies Red, Green, Blue channels each as two hex digits (00–FF = 0–255). #FF0000 is pure red, #00FF00 is lime, #0000FF is blue, #FFFFFF is white, #000000 is black. There are 256³ = 16,777,216 possible colours. Short codes like #F80 expand to #FF8800.
What is the difference between hex and binary?
Binary (base 2) uses only 0 and 1 — 8 bits for a byte. Hexadecimal (base 16) uses 0–9 and A–F — only 2 digits for a byte. One hex digit always represents exactly 4 binary bits. FF in hex = 11111111 in binary. Hex is simply a compact way to read and write binary data.
How are hex numbers used in memory addresses?
Computer memory is byte-addressed and addresses are shown in hex for compactness. A 32-bit address like 0x7FFFFFFF is 8 hex digits instead of 32 binary digits. The 0x prefix denotes hex in C, C++, Python, and assembly. Debuggers, operating systems, and network protocols all use hex for addresses and data.

Related Calculators

MB
Mustafa Bilgic
Published: 1 January 2025  |  Updated: 20 February 2026

Official Sources

Data verified against official UK government sources. Last checked April 2026.