Convert HEX Colour Codes to RGB
Paste one HEX colour or a whole list and get matching rgb() values, with the alpha channel from 4 and 8-digit codes preserved. Choose classic comma syntax, modern space syntax, bare channel numbers or HSL.
How to convert HEX to RGB
- Paste your HEX codes into the input box, one per line. The leading # is optional.
- Pick an output format, such as rgb(37, 99, 235) or the modern rgb(37 99 235 / 50%).
- Untick "Keep alpha" if you want opaque colours even when the code has transparency.
- Copy the whole result list, copy single rows from the table, or download a text file.
How HEX maps to RGB
A six-digit HEX code is three pairs of base-16 digits: red, green and blue, each from 00 (0) to FF (255). So #2563EB is red 0x25 = 37, green 0x63 = 99 and blue 0xEB = 235. Three-digit shorthand doubles each digit (#0af becomes #00aaff), and an optional fourth or eighth digit pair is alpha, where FF is fully opaque and 80 is about 50%. Going the other way? Use the RGB to HEX Converter.
Benefits
- Converts hundreds of colours in one go, keeping line order so results line up with your input.
- Understands every HEX length CSS accepts, including alpha.
- Each invalid line is reported with its line number and the reason.
Limitations
- Named colours (such as rebeccapurple) and other notations are not accepted here; use the Color Picker for those formats.
- Up to 2,000 lines are converted at a time and the preview table shows the first 200.
Privacy and security
Conversion is simple arithmetic performed in your browser. Nothing you paste is uploaded or stored.
Read our privacy policy for details about the site as a whole.
Frequently asked questions
Is rgba() still needed?
No. Since CSS Color Level 4, rgb() accepts an alpha value and rgba() is an alias, and all modern browsers support it. The comma form is still useful if you must support very old browsers.
How is the alpha in #rrggbbaa converted?
The last pair is a number from 0 to 255 divided by 255. For example 80 hex is 128, which gives 128 ÷ 255 ≈ 0.502, shown as 0.502 or 50.2%.
Are HEX codes case-sensitive?
No. #FF8800 and #ff8800 are the same colour. Lowercase is a common convention because it compresses slightly better.