How this conversion is calculated
- Split the hex code into pairs: 63 66 F1.
- Convert each pair from base 16: 63 = 6 x 16 + 3 = 99.
- 66 = 6 x 16 + 6 = 102. F1 = 15 x 16 + 1 = 241.
- Result: rgb(99, 102, 241).
Code snippets
color: #6366F1;--brand: #6366F1;$brand: #6366F1;UIColor(red: 0.388, green: 0.4, blue: 0.945, alpha: 1)Color(red: 0.388, green: 0.4, blue: 0.945, opacity: 1)<color name="brand">#6366F1</color>Color(0xFF6366F1)Color.argb(255, 99, 102, 241)Color(0xFF6366F1)new Color32(99, 102, 241, 255)Color.FromArgb(255, 99, 102, 241)(99, 102, 241)Convert a list
Paste up to 1,000 values, one per line. Each line is converted to RGB.
More color formats (HWB, LAB, LCH, OKLab, XYZ and more)
Common colors reference table
Click a name to load it into the converter.
| Color | HEX | RGB | HSL |
|---|---|---|---|
| #000000 | rgb(0, 0, 0) | hsl(0, 0%, 0%) | |
| #FFFFFF | rgb(255, 255, 255) | hsl(0, 0%, 100%) | |
| #FF0000 | rgb(255, 0, 0) | hsl(0, 100%, 50%) | |
| #00FF00 | rgb(0, 255, 0) | hsl(120, 100%, 50%) | |
| #0000FF | rgb(0, 0, 255) | hsl(240, 100%, 50%) | |
| #FFFF00 | rgb(255, 255, 0) | hsl(60, 100%, 50%) | |
| #00FFFF | rgb(0, 255, 255) | hsl(180, 100%, 50%) | |
| #FF00FF | rgb(255, 0, 255) | hsl(300, 100%, 50%) | |
| #C0C0C0 | rgb(192, 192, 192) | hsl(0, 0%, 75%) | |
| #808080 | rgb(128, 128, 128) | hsl(0, 0%, 50%) | |
| #800000 | rgb(128, 0, 0) | hsl(0, 100%, 25%) | |
| #808000 | rgb(128, 128, 0) | hsl(60, 100%, 25%) | |
| #008000 | rgb(0, 128, 0) | hsl(120, 100%, 25%) | |
| #800080 | rgb(128, 0, 128) | hsl(300, 100%, 25%) | |
| #008080 | rgb(0, 128, 128) | hsl(180, 100%, 25%) | |
| #000080 | rgb(0, 0, 128) | hsl(240, 100%, 25%) | |
| #FFA500 | rgb(255, 165, 0) | hsl(39, 100%, 50%) | |
| #FF6347 | rgb(255, 99, 71) | hsl(9, 100%, 64%) | |
| #FFD700 | rgb(255, 215, 0) | hsl(51, 100%, 50%) | |
| #4B0082 | rgb(75, 0, 130) | hsl(275, 100%, 25%) |
How to use
Paste or pick a hex code
Type a code such as #E4572E into Input (HEX), or use the color picker next to it. Shorthand like #F80 and 8 digit codes like #E4572ED9 are accepted, with or without the #.
Read the RGB result
The highlighted Result (RGB) card shows rgb() or, for codes with alpha, rgba(). Under it are the channels as 0 to 255, as 0 to 1 decimals, as percentages and in modern space syntax.
Copy the format you need
Press Copy on the result or on any variant. The grid below also lists HEX, HSL, HSV, CMYK and OKLCH. Use Switch to RGB to HEX to convert in the other direction.
Why HEX to RGB Converter
- Reads 3, 4, 6 and 8 digit hex, # optional, with rgba() for alpha.
- Shows 0 to 255, 0 to 1 and percent values.
- Step by step math and code snippets for 12 platforms.
- Bulk mode converts up to 1,000 codes with CSV export.
Hex to RGB formula with a worked example
A hex color is three base 16 numbers written side by side. Each pair runs from 00 (0) to FF (255). To convert a pair, multiply the first digit by 16 and add the second. Letters count as numbers: A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15.
Take #6366F1. The red pair 63 is 6 x 16 + 3 = 99. The green pair 66 is 6 x 16 + 6 = 102. The blue pair F1 is 15 x 16 + 1 = 241. So #6366F1 is rgb(99, 102, 241). As decimals from 0 to 1 that is 0.388, 0.4 and 0.945, which you get by dividing each value by 255.
For an 8 digit code, the fourth pair is alpha. Divide it by 255 to get the opacity used in rgba(). For example, 80 is 128, and 128 divided by 255 is about 0.5.
Common colors in HEX and RGB
These are the 16 basic CSS colors plus orange, with their exact HEX and RGB values. They are handy for quick checks and for spotting when a code has been mistyped. Note that 80 in hex is 128, just over half of 255.
| Name | HEX | RGB |
|---|---|---|
| Black | #000000 | rgb(0, 0, 0) |
| White | #FFFFFF | rgb(255, 255, 255) |
| Red | #FF0000 | rgb(255, 0, 0) |
| Lime | #00FF00 | rgb(0, 255, 0) |
| Blue | #0000FF | rgb(0, 0, 255) |
| Yellow | #FFFF00 | rgb(255, 255, 0) |
| Aqua (cyan) | #00FFFF | rgb(0, 255, 255) |
| Fuchsia (magenta) | #FF00FF | rgb(255, 0, 255) |
| Silver | #C0C0C0 | rgb(192, 192, 192) |
| Gray | #808080 | rgb(128, 128, 128) |
| Maroon | #800000 | rgb(128, 0, 0) |
| Olive | #808000 | rgb(128, 128, 0) |
| Green | #008000 | rgb(0, 128, 0) |
| Purple | #800080 | rgb(128, 0, 128) |
| Teal | #008080 | rgb(0, 128, 128) |
| Navy | #000080 | rgb(0, 0, 128) |
| Orange | #FFA500 | rgb(255, 165, 0) |