How to use the HEX to RGB Converter
- 1Paste or type any 3-, 6-, or 8-digit HEX code, rgb()/rgba() string, or hsl()/hsla() value into the Color Input box.
- 2Alternatively, click the synced native Picker square on the right to select any shade visually.
- 3Inspect the live color preview swatch together with Contrast vs White and Contrast vs Black ratios.
- 4Click Copy inside any of the four output cards: HEX (6-digit), HEX (8-digit with Alpha), RGB / RGBA, or HSL / HSLA.
What the HEX to RGB Converter does
The converter parses CSS color formats inside your browser and computes equivalent representations plus luminance contrast ratios:
- Detects and parses 3-digit shorthand HEX (#F09), 6-digit HEX (#7839EE), 8-digit HEX with alpha (#7839EE80), rgb()/rgba(), and hsl()/hsla() syntax automatically.
- Calculates all four formatted output strings simultaneously and places an individual Copy button next to every format.
- Computes relative sRGB luminance to display real-time Contrast vs White (#FFFFFF) and Contrast vs Black (#000000) ratios.
- Keeps the native HTML color Picker synchronized with your typed HEX value and shows a clear syntax hint if an input cannot be parsed.
Example
#7839EE
HEX (6-digit): #7839EE HEX (8-digit): #7839EEFF RGB: rgb(120, 57, 238) HSL: hsl(261, 84%, 58%) Contrast vs White: 6.23:1 | Contrast vs Black: 3.37:1
Because Contrast vs White exceeds 4.5:1 while Contrast vs Black is 3.37:1, pure white text over #7839EE meets common WCAG normal-text contrast guidelines.
Frequently asked questions
What is the difference between HEX and RGB color codes?
Both HEX and RGB describe the same red, green, and blue intensity values from 0 to 255. RGB writes those numbers in decimal (such as rgb(120, 57, 238)), whereas HEX writes the same channels as two-digit base-16 hexadecimal pairs (#7839EE).
What does the alpha value in RGBA, HSLA, or 8-digit HEX mean?
Alpha controls transparency from 0 (completely transparent) to 1 (fully opaque) in rgba()/hsla(), or 00 to FF in 8-digit HEX. Lower alpha lets underlying background colors show through.
What is considered a good text contrast ratio?
Under common WCAG accessibility guidelines, normal body text generally targets a contrast ratio of at least 4.5:1 against its background, while large text (18pt regular or 14pt bold) targets at least 3:1.
Can I paste an RGB or HSL string to get its HEX equivalent?
Yes. The single Color Input field automatically detects HEX, rgb(), rgba(), hsl(), and hsla() syntax and converts it into all four output cards.
Related tools
View All ToolsCSS Gradient Generator
Design linear and radial CSS gradients visually with angle sliders, multi-stop color controls, starter presets, and one-click CSS copy.
CSS Box Shadow Generator
Build multi-layer CSS box-shadow styles visually with sliders for horizontal/vertical offset, blur, spread, color opacity, and inset shadows.
Favicon Generator
Upload your logo to generate complete favicon packs: 16x16, 32x32, 180x180 Apple Touch, and 192x192 Android manifest icons.