HEX to RGB
Turn hex colour codes into RGB values, a whole list at a time.
What this tool does
HEX to RGB reads each line of your input as a colour and writes the equivalent sRGB triplet. Shorthand is expanded the way CSS expands it, by doubling each digit, so #fff becomes rgb(255, 255, 255) and #10B98180 keeps its alpha. The leading hash is optional for 3, 4, 6 and 8 digit codes, which means a value copied out of a spreadsheet or a Sass variable converts without being tidied up first.
The input is deliberately wider than the tool's name. Alongside hex it accepts the 148 CSS colour names, the keyword transparent, and rgb(), hsl(), hwb(), lab(), lch(), oklab(), oklch() and color(srgb …) notation — so a stylesheet you are auditing can be pasted as it stands rather than filtered first. Up to 200 colours convert in a run; a longer list is refused with a count rather than silently truncated, and lines starting with // or a hash followed by a space are skipped, which lets you label sections of a palette.
Results come back in two parts. First a grid of swatch cards, one per line, each showing the colour itself, the text you typed and the value it converted to, so a wrong paste is obvious at a glance. Beneath it sits the table those cards are drawn from: Input, RGB, and R, G, B and Alpha as separate numbers, one row per colour. The output panel is narrow, so the last of those columns may need a sideways scroll. Copy output stays deliberately plain — the converted values only, one to a line, without the input column — because that is the form you paste back into a stylesheet.
Two things are worth knowing before you trust a number. Alpha from an 8-digit hex is a byte, not a fraction: the pair 80 is 128/255, which this colour converter reports as 0.502 rather than 0.5, and the same holds for every byte that is not a multiple of 51. And everything here is treated as sRGB — there is no colour management, so a hex lifted from a Display P3 document is read as though it were sRGB, and a lab() or oklch() value outside the sRGB gamut is clamped channel by channel rather than gamut-mapped, which can come back visibly flatter than the colour you started with. The conversion runs in this browser tab; the list is not uploaded, and the page keeps working with the network off.
How to use it
- Paste your codes, one to a line. Hex with or without the hash, 3, 4, 6 or 8 digits. Blank lines are ignored, and so are lines beginning with // or a hash and a space, so a palette can carry headings.
- Choose the output notation. Legacy rgb(59, 130, 246) for broad support, modern rgb(59 130 246) for CSS Color 4, bare 59, 130, 246 for pasting into code, or percentages at two decimal places.
- Decide what happens to alpha. Include it only for translucent colours, always, or never. In legacy notation an included alpha switches the function to rgba(); modern and percentage output use the slash form, and bare values append a fourth number.
- Scan the swatches, then read the table. Every card pairs the rendered colour with the line you typed and the converted value, so a wrong paste is obvious at a glance, and the table under the grid gives the same colours as numbers — Input, RGB, R, G, B and Alpha. Copy output puts the converted values on the clipboard, one to a line, without the input column.
Processing & privacy
Runs on your device. Your file is processed directly in this browser.
Common use cases
Building an rgba() overlay from a brand hex
A scrim or a shadow needs the channels separated so opacity can be set independently of the colour it came from.
Filling in a design token table
Token documentation usually lists both notations. Converting the hex column in one pass keeps the RGB column consistent with it.
Moving a palette out of CSS
Android, OpenGL, canvas code and most plotting libraries want channel numbers, not hex strings. The bare values notation drops straight in.
Checking what a colour name resolves to
A stylesheet inherited with rebeccapurple or lightslategrey in it converts alongside the hex codes, so the whole list ends up in one comparable form.
Questions
Does the list of colours leave my machine?
What does #fff convert to?
Why is my alpha 0.502 and not 0.5?
Can I paste rgb() values or colour names instead of hex?
Where are the separate R, G and B columns?
It rejected my code for having five hex digits — why?
Does it understand wide-gamut colour?
I have more than 200 colours — what happens?
Can it pull the hex out of an image or a screenshot?
Related tools
- WCAG Contrast Checker — Test colour pairs against AA and AAA thresholds.
- RGB to HEX — Convert RGB values to a hex colour.
- HEX to HSL — Convert hex to hue, saturation and lightness.
- HSL to HEX — Convert HSL values back to a hex colour.
- CMYK Converter — Convert between RGB and CMYK for print work.
- Color Picker — Pick a colour and copy it in any notation.