RGB & HEX Colour Converter

Convert between RGB, HEX and HSL — type in any field or drag sliders to see instant updates with step-by-step mathematical working.

#3B82F6

rgb(59, 130, 246)

hsl(217°, 91%, 60%)

RGB Channels (0–255)
R
G
B
HEX Code
#

3-digit shorthand also supported (e.g. F00 → FF0000)

HSL Values
H °
S %
L %

Step-by-step solution

Showing: RGB → HEX
Preset Palette
Hover for hex
Hex Digits (Base 16)
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 A
11 B
12 C
13 D
14 E
15 F

RGB & HEX Colour Converter Explained

Core concepts, classroom applications, and plain-English explanations for all audiences.

Where you'll actually use this

Every colour on a website or app is defined by a code. #FF6600 is a bright orange. RGB(255, 102, 0) is the same colour written differently. Graphic designers switching between Photoshop and CSS need to translate between these formats constantly. Social media brand guidelines list exact hex codes to ensure logo colours match precisely everywhere.

Worked example

"You're coding a website and want a red button (#FF3300). What are the RGB values?"

#FF3300 → split into pairs: FF, 33, 00

FF (hex) = 15×16 + 15 = 255 (red)

33 (hex) = 3×16 + 3 = 51 (green)

00 (hex) = 0 (blue)

Result: RGB(255, 51, 0) — a bright red-orange

Each hex pair goes from 00 (no intensity) to FF (full intensity). 16 digits: 0–9, then A=10, B=11, C=12, D=13, E=14, F=15.

Key colour codes to recognise

  • → #000000 = black, #FFFFFF = white: All channels at zero = no light = black. All at maximum = full light = white.
  • → #FF0000 = pure red, #00FF00 = pure green, #0000FF = pure blue: The primary colours of light — additive mixing, not paint.

Common mistake

Thinking hex uses 0–16. Hex is base 16 (0–15 per digit). Each pair of hex digits gives 256 values (00–FF), which is why each of R, G, B ranges from 0 to 255.

RGB, HEX, and HSL Colour Converter

Our colour converter is an essential tool for anyone working with digital colours, from GCSE Computer Science students learning about colour representation to professional web developers and graphic designers. It allows you to seamlessly convert colours between three common formats: RGB, Hexadecimal (HEX), and HSL.

Input your colour in any of the three formats, and our tool will instantly provide the equivalent values in the others. See your chosen colour come to life with a live preview swatch, and for those curious about the underlying maths, we provide a step-by-step breakdown of how hexadecimal conversions are performed using repeated division by 16. Understand, convert, and apply colours with confidence.

Common mistakes to avoid

  • Using '0-100' for RGB values:RGB channels (Red, Green, Blue) are 8-bit values, meaning they range from 0 to 255, not 0 to 100. Using 0-100 will result in incorrect or unexpected colours. Always use values between 0 and 255 for each RGB channel. For example, pure red is RGB(255, 0, 0).
  • Forgetting the '#' symbol in Hex codes:The '#' symbol is crucial for identifying a string as a hexadecimal colour code in many contexts, especially in web development (CSS, HTML). Without it, the code might be interpreted as a regular string or number. Always prefix your 6-digit hexadecimal colour code with a hash symbol, e.g., #FF0000, not FF0000.
  • Confusing HSL with HSV/HSB:While HSL (Hue, Saturation, Lightness) and HSV/HSB (Hue, Saturation, Value/Brightness) are similar, they calculate 'lightness' or 'brightness' differently. This means the same H, S values can produce different colours depending on whether L or V/B is used. Be aware of the specific colour model you are using. HSL is often preferred for its intuitive adjustment of lightness, while HSV/HSB is sometimes used in graphics software for its direct correlation to colour mixing.

Questions students ask

What is the difference between RGB and HEX?
RGB (Red, Green, Blue) represents colours using three decimal values, each ranging from 0 to 255, indicating the intensity of red, green, and blue light. HEX (Hexadecimal) is a more compact way to represent the same RGB values using a six-digit hexadecimal code (e.g., #RRGGBB). Each pair of hex digits (RR, GG, BB) corresponds to an RGB channel, with 'FF' being 255 and '00' being 0. HEX is widely used in web development due to its brevity.
What does HSL stand for and why is it useful?
HSL stands for Hue, Saturation, and Lightness. It's a colour model designed to be more intuitive for humans to understand and manipulate colours compared to RGB or HEX. Hue (0-360 degrees) defines the pure colour itself (e.g., red, green, blue, yellow). Saturation (0-100%) defines the intensity or purity of the colour (0% is grey, 100% is full colour). Lightness (0-100%) defines how bright or dark the colour is (0% is black, 100% is white, 50% is normal colour). This model makes it easier to create variations of a colour, like making it lighter or more vibrant, without changing its fundamental hue.
Why do hex colour codes use letters A to F?
Hexadecimal is a base-16 numbering system, meaning it uses 16 unique symbols to represent numbers. Unlike our familiar base-10 (decimal) system which uses 0-9, hexadecimal needs additional symbols for values ten through fifteen. These are represented by the letters A (10), B (11), C (12), D (13), E (14), and F (15). This allows each pair of hex digits (e.g., 'FF') to represent a value from 0 to 255 (00 to FF), perfectly matching the 256 possible intensity levels for an 8-bit colour channel in RGB.
What is the range of each RGB channel?
Each of the three RGB channels (Red, Green, and Blue) has an intensity range from 0 to 255. A value of 0 means that particular colour component is completely absent, while a value of 255 means it is at its maximum intensity. For example, RGB(255, 0, 0) is pure red, RGB(0, 255, 0) is pure green, and RGB(0, 0, 0) is black (no light).
How do I convert a hex code to RGB by hand?
To convert a hex code (e.g., #A3C1AD) to RGB by hand, you need to split the 6-digit code into three 2-digit pairs (RR, GG, BB) and convert each pair from hexadecimal to decimal:

1. Split the hex code: For #A3C1AD, you get A3 (Red), C1 (Green), AD (Blue).
2. Convert each pair: Each hex digit's value is multiplied by its place value (16^1 for the first digit, 16^0 for the second).
Red (A3): (A 16^1) + (3 16^0) = (10 16) + (3 * 1) = 160 + 3 = 163
Green (C1): (C 16^1) + (1 16^0) = (12 16) + (1 * 1) = 192 + 1 = 193
Blue (AD): (A 16^1) + (D 16^0) = (10 16) + (13 * 1) = 160 + 13 = 173
3. Combine the results: The RGB value for #A3C1AD is RGB(163, 193, 173).