HEX to RGB
Hex color in, RGB channels and CSS strings out
- 100% Free
- Files stay private
- Works in your browser
rgb(32, 107, 196)rgba(32, 107, 196, 1)32, 107, 196Paste any hex colour (short, long, or with an alpha byte). The RGB channels and CSS strings update live in your browser.
How it works
Enter a hex colour
Type or paste a code like #206bc4 into the HEX colour box, or click the colour swatch beside it to pick a colour.
Adjust the opacity
To make the colour see-through, drag the Alpha (opacity) slider. The preview below it, drawn over a checkerboard, shows the effect.
Copy rgb() or rgba()
Read the Red, Green and Blue values, then use the copy button on the rgb(), rgba() or R, G, B row.
Convert any hex color to its red, green, and blue channels and ready-to-use rgb() and rgba() CSS strings. Supports short, long, and alpha hex, with a live preview and an opacity slider.
What is HEX to RGB?
HEX to RGB is a free tool that turns a hexadecimal color code into its RGB channel values and CSS color strings. Hex is compact and common in design files, but stylesheets, canvas code, and many APIs expect rgb() or rgba() values instead. This tool extracts the exact channel numbers, adds an adjustable alpha, and shows a live swatch so you can see the color as you work.
Who Benefits from This Tool
- Web developers: get the rgb() or rgba() string a stylesheet or script needs from a hex code.
- UI designers: read the channel breakdown of a color pulled from a mockup.
- Front-end engineers: add transparency to a solid hex color with a precise alpha value.
- Email developers: produce rgb() values for clients that handle it more reliably than hex.
- Students: understand how hex pairs map to red, green, and blue channels.
Key Features
- Flexible input: accepts #rgb, #rgba, #rrggbb, and #rrggbbaa, with or without the leading #.
- Alpha support: a 4- or 8-digit hex seeds the opacity slider automatically.
- Opacity slider: adjust alpha from 0 to 1 to build the exact rgba() you need.
- Live swatch: a checkerboard-backed preview shows transparency accurately.
- Multiple outputs: copy rgb(), rgba(), or the bare R, G, B values.
- Color picker: click the swatch to choose a color visually and fill the hex field.
- Channel pills: see red, green, blue, and alpha values at a glance.
How to Use
- Type or paste a hex color, such as #206bc4, 206bc4, #f00, or #206bc4cc.
- Or click the swatch to pick a color with your system color picker.
- Drag the alpha slider to set opacity if you need an rgba() value.
- Read the channel pills and the rgb(), rgba(), and R, G, B outputs.
- Copy the format you need with its copy button.
Common Use Cases
- Converting a brand hex code into the rgb() string a stylesheet expects.
- Adding transparency to a solid color by producing an rgba() value.
- Extracting individual channel numbers for canvas or WebGL code.
- Translating a hex value with an alpha byte into a readable rgba() string.
- Reading the RGB makeup of a color sampled from a design file.
Tips and Best Practices
- Paste an 8-digit hex like #206bc4cc to have the alpha slider set itself automatically.
- Use rgba() when you need transparency; use rgb() when the color is fully opaque.
- You can omit the leading #. The tool accepts bare hex just as readily.
- Short 3-digit hex expands to full pairs, so #f00 becomes rgb(255, 0, 0).
- Check the checkerboard preview to judge how a semi-transparent color will look over a background.
Limitations and Notes
All conversion happens in your browser and nothing is uploaded. Hex to RGB is an exact, lossless mapping for the color channels, since each pair of hex digits corresponds directly to a 0 to 255 value. The alpha byte in an 8-digit hex is converted to a 0 to 1 value and rounded to two decimals for readability, so a round-trip through alpha may differ slightly. Invalid input, such as a string that is not a recognized hex length, produces a clear error rather than a guessed result.
FAQs
The tool accepts 3-digit (#rgb), 4-digit (#rgba), 6-digit (#rrggbb), and 8-digit (#rrggbbaa) hex, with or without the leading # symbol.
If you paste a hex with an alpha component, the last byte is read as opacity and seeds the slider. You can then adjust it to fine-tune the rgba() output.
Yes for the color channels. Each hex pair maps directly to a 0 to 255 value. The alpha is expressed as a 0 to 1 number rounded to two decimals for readability.
Yes. Bare hex such as 206bc4 works the same as #206bc4, and short forms like f00 expand automatically.
rgb() specifies a fully opaque color, while rgba() adds an alpha channel for transparency. Lower the opacity slider to get an rgba() value.
No. The conversion runs entirely in your browser, so the colors you enter stay on your device.