How do I convert RGB to HEX?
Convert each RGB channel (0–255) to a two-digit hexadecimal number and concatenate them with a
#
prefix. For example,
rgb(255, 99, 71)
: R=255→
FF
, G=99→
63
, B=71→
47
→
#FF6347
(Tomato). You can also divide each value by 16 to get the two hex digits manually.
What is the formula for RGB to HEX conversion?
The formula is
HEX = '#' + R.toString(16).padStart(2,'0') + G.toString(16).padStart(2,'0') + B.toString(16).padStart(2,'0')
(uppercased). Each decimal value (0–255) maps to exactly two hexadecimal characters (00–FF). The
padStart(2,'0')
ensures values under 16 get a leading zero (e.g., 11 →
0B
, not
B
).
What is the difference between RGB and HEX?
RGB and HEX represent exactly the same colors — they're just different notations.
RGB
uses three decimal numbers separated by commas (
rgb(255, 165, 0)
), making individual channel values easy to read.
HEX
uses a single compact string (
#FFA500
) preferred in CSS, HTML, and design tools. Converting between them is lossless.
Can I convert HEX back to RGB?
Yes. Split the 6-character HEX code into three pairs (RR, GG, BB) and convert each from hexadecimal to decimal using base-16 arithmetic. Example:
#1E90FF
→ 1E=30, 90=144, FF=255 →
rgb(30, 144, 255)
(DodgerBlue). On this tool, simply type a HEX code into the HEX input and click Apply to convert it to RGB automatically.
What does RGBA mean and how is it different from RGB?
RGBA adds a fourth channel —
Alpha
— to the RGB model. Alpha controls transparency/opacity, ranging from 0 (fully transparent) to 1 (fully opaque) in CSS, or 0–255 in 8-digit HEX. For example,
rgba(245, 158, 11, 0.5)
is 50% transparent amber. Enable the Alpha toggle on this tool to include the alpha channel in all output formats.
What are WCAG contrast requirements?
WCAG 2.1 defines these minimum contrast ratios:
•
AA Normal Text:
4.5:1 (body copy, UI labels)
•
AA Large Text (18pt+/14pt bold+):
3:1
•
AAA Enhanced Normal:
7:1
•
AAA Large Text:
4.5:1
Use this tool's contrast checker to test your foreground color against any background instantly.
What is HSL and when should I use it?
HSL (Hue, Saturation, Lightness) describes color in human-intuitive terms. Hue is the color angle (0–360°), Saturation is intensity (0–100%), and Lightness is brightness (0–100%). Use HSL when building design systems or color scales — for example, generating 9 shades of a brand color by varying lightness from 10% to 90% while keeping hue and saturation constant.
What is CMYK and why is it different from RGB?
CMYK (Cyan, Magenta, Yellow, Key/Black) is a
subtractive
color model used in printing. Physical inks absorb (subtract) light, so combining all colors produces black. RGB is
additive
— screen pixels emit light, so combining all channels produces white. When sending designs to print, always convert RGB to CMYK to ensure color accuracy, as not all RGB colors can be reproduced with CMYK inks.
What are the HEX codes for the most common colors?
Here are the most commonly used HEX codes:
Black
#000000
· White
#FFFFFF
· Red
#FF0000
· Green
#008000
· Blue
#0000FF
· Yellow
#FFFF00
· Orange
#FFA500
· Purple
#800080
· Pink
#FFC0CB
· Gray
#808080
· Cyan
#00FFFF
· Magenta
#FF00FF
· Navy
#000080
· Teal
#008080
· Lime
#00FF00
See the full reference table above for more colors with RGB, HSL values and use cases.
Is this tool free and does it store my data?
This tool is completely free with no account required. All color conversions run entirely in your browser using JavaScript — no color values, history, or preferences are sent to any server. The only data stored locally is your color history (in localStorage), which never leaves your device and can be cleared at any time.