Home/Tools/Developer Tools/HEX to RGB
HEX to RGB Converter
Developer ToolsAlso available as:Color ConverterRGB to HEX
RGB
rgb(79, 70, 229)
HEX
#4f46e5
Processed in your browser. A copy of each run is saved to your past runs so you can reopen it. Privacy
What the HEX to RGB does
HEX to RGB converts a hexadecimal color code such as #4F46E5 into its red, green and blue values, rgb(79, 70, 229), ready to paste into CSS, a canvas call or an image editor. Three-, four-, six- and eight-digit codes are accepted, with or without the #, and an eight-digit code gives an rgba() value with alpha. HSL, HSV, approximate CMYK and contrast ratios are shown too. It is for developers and designers; it does not manage palettes.
How to use it
- 1Paste the hex code: #4F46E5, 4F46E5, #48E (shorthand) or #4F46E580 (with alpha).
- 2Read the rgb() value in the first card; the hex is echoed next to it.
- 3Press Copy on rgb(), or on rgba() when the code carries alpha.
- 4Check the HSL value if you need to make a lighter or darker shade.
Options explained
- Hex input forms
- 3 digits (#48E expands to #4488EE), 4 digits (with alpha), 6 digits or 8 digits, and the # is optional. Case does not matter.
- RGB and RGBA output
- rgb(r, g, b) in the comma syntax every browser accepts. When the input has alpha, rgba() carries it as a decimal between 0 and 1.
- Picker
- Click the swatch to pick visually; the hex and RGB update together.
- Other notations
- HSL, HSLA, HSV, approximate CMYK, nearest CSS name, Tailwind arbitrary value and a CSS custom property, each with Copy.
- Contrast
- WCAG ratios of this color as text on white and black, with the level reached.
Common problems and limits
A code with 1, 2, 5 or 7 digits, or with characters outside 0–9 and A–F, is rejected with a message naming the expected lengths.
CMYK is an approximate formula without an ICC profile.
Wide-gamut (Display P3, OKLCH) is not supported; hex codes are sRGB by definition.
Who uses it
- Front-end developers: Convert a hex from the design file into rgb() to add a transparent variant with rgba() in CSS.
- Designers: Turn brand hex codes into RGB for Photoshop, Canva or a video editor's color dialog.
- Game and app developers: Get the three channel values a graphics API or a color constructor expects.
- Students: See how each pair of hex digits maps to a channel from 0 to 255.
Frequently asked
How do I convert hex to RGB?
Split the six digits into three pairs and convert each from base 16 to decimal. #4F46E5: 4F = 79, 46 = 70, E5 = 229, so rgb(79, 70, 229). Paste the code above to do it instantly.
How do I calculate RGB from hex by hand?
For each pair, multiply the first digit by 16 and add the second, using A=10 through F=15. E5 is 14 × 16 + 5 = 229.
What is #0000FF in RGB?
rgb(0, 0, 255): pure blue. It is also the CSS color name 'blue' and hsl(240, 100%, 50%).
What does a 3-digit hex code mean?
Shorthand where each digit is doubled: #48E is #4488EE, rgb(68, 136, 238). It only exists for colors whose channel pairs repeat a digit.
How do I convert hex with alpha to rgba?
An 8-digit code's last pair is alpha: #4F46E580 has alpha 80 hex = 128, and 128 ÷ 255 ≈ 0.5, so rgba(79, 70, 229, 0.5). The tool shows this in the RGBA row.
Is hex to RGB conversion exact?
Yes. Both are 8 bits per channel in sRGB, so the conversion is lossless in both directions.
Automation: an MCP tool convert_color(value, to) → {hex, rgb, hsl} and an n8n node are planned for this tool.