HEX to RGB Converter with HSL & CMYK Values
Paste a HEX code and copy its RGB, HSL and CMYK values instantly, with 4 harmony colors, a contrast check against white and CSS palette export.
Updated November 2026
Reviewed by Rafael Duarte
Active Preview
#197FE6
Harmony Colors
Format Conversions
Tip: Click a harmony color swatch to use it. Press Shift+Enter to copy the HEX value.
How to convert HEX to RGB
Paste a HEX code, get RGB, HSL and CMYK
1. Paste the HEX code
Type or paste a 6-digit hex code, with or without the # (for example #3A86FF), or pick the color from your browser's color swatch.
2. Copy the format you need
Format Conversions shows HEX, RGB, HSL, and CMYK side by side. Click the copy icon next to any of them.
3. Save to a palette and export
"Save to Palette" keeps the color; "Export Palette" downloads a palette.css file with the colors as CSS custom properties.
What this HEX to RGB converter does
From HEX to RGB, HSL and CMYK, no math by hand
HEX to RGB, HSL and CMYK at once
All three appear next to each other, ready to copy: rgb() with 0–255 channels, hsl() with whole-number degrees and percentages, and CMYK as four numbers from 0 to 100.
Standard formulas
RGB comes straight from the hex pairs; HSL and CMYK use the standard formulas from RGB, rounded to whole numbers.
4 harmony colors
Your color with the hue rotated +90°, +150°, +180°, and +270°. Only +180° is the true complement; +90° and +270° complete a square (tetradic) scheme and +150° is one half of a split complement. Click a swatch to use it.
Contrast vs. white
WCAG AA (4.5:1) and AAA (7:1) badges show whether the color works as text on a white background.
CSS custom properties export
Save several colors and download a palette.css with --palette-1, --palette-2 and so on.
Keyboard shortcut to copy
Press Shift+Enter while no text field has focus to copy the active HEX value without clicking.
Color formats explained
What each notation means and where it's used
When you'll reach for this tool
The scenarios that come up most often
Design-to-code handoff
Designers hand off colors in HEX; in code you often want rgb() to work with transparency, or hsl() for theme variations and hover states.
Quick contrast check
See whether a brand color passes AA as text on white. To test text on any background, use the Color Contrast Checker.
A first reference for print
Get a rough CMYK for a screen color to start the conversation with your print shop. The final values should come from the color profile the printer uses, not from this formula.
Building a design system
Save every brand color into one palette, then export the whole set as CSS custom properties in a single download. Starting from a photo or logo instead? Pull the colors from an image.
Common mistakes
Assuming on-screen RGB matches printed CMYK exactly
The CMYK here is the simple formula, with no ICC color profile, so it can't tell you whether a color is printable. Some vivid screen blues and greens fall outside the printable gamut; check with your printer before you finalize the file.
Misreading HSL lightness at 50%
50% lightness is the pure hue; values above it lighten toward white, below it darken toward black — it's not the same axis as HSV brightness.
Forgetting the # when pasting hex
Hex codes work here with or without the leading #, but keep the habit — plenty of other tools and CSS itself require it.
Pasting a 3-digit shorthand hex
Codes like #FFF aren't recognized; the field needs all 6 digits. Double each character before pasting, so #FFF becomes #FFFFFF.
Why use this HEX to RGB converter
Paste one HEX code and copy RGB, HSL, and CMYK from the same screen, with no need for a separate converter for each format.
The contrast badge against white saves an extra step: you already know whether a color works as text on white before you leave the page. Need to choose a color from scratch or grab one from your screen? Pick it visually or with the eyedropper first.
Everything runs in your browser, with no signup and nothing sent to a server.
Frequently asked questions
Type or paste a 6-digit hex code, with or without the #, and the RGB value appears right away in the RGB (Red, Green, Blue) field, ready to copy. For example, #FF8000 converts to rgb(255, 128, 0).
Split the code into three pairs and convert each one from hexadecimal to decimal: the first is red, the second green, the third blue. For #1A73E8: 1A = 1×16 + 10 = 26, 73 = 7×16 + 3 = 115 and E8 = 14×16 + 8 = 232, so it's rgb(26, 115, 232).
No. This tool always starts from HEX; there's no field for typing RGB, HSL, or CMYK. By hand, reverse the process: divide each channel by 16, and the quotient is the first digit and the remainder the second (10 = A, 11 = B … 15 = F). rgb(26, 115, 232) becomes 1A, 73 and E8, or #1A73E8.
HSL stands for Hue, Saturation, and Lightness, and it lets you adjust a color in terms that are easy to reason about: raise lightness for a pastel version, lower saturation to gray it out. It's the format most developers reach for in CSS when they need predictable variations like hover or disabled states.
It calculates the color's relative luminance and compares it against white using the WCAG formula. A ratio of 4.5:1 or higher passes AA for normal text, and 7:1 or higher passes the stricter AAA level. The check here is only against white; for any text and background pair, with a suggested fix, use the Color Contrast Checker.
HEX is simply RGB encoded in hexadecimal. #3A86FF is exactly rgb(58, 134, 255) — each pair of hex digits represents the red, green, and blue channel as a value from 00 to FF.
Paste the hex code and CMYK appears in the CMYK (Cyan, Magenta, Yellow, Key) field as four numbers from 0 to 100, without the % sign: #1A73E8 gives 89, 50, 0, 9. It's the simple math conversion, with no ICC color profile. Your printer converts with their own profile, so treat the number as a reference and check a proof before you finalize the file.
They're your color with the hue rotated in HSL space while saturation and lightness stay fixed: +90°, +150°, +180°, and +270°. Only the +180° swatch is the true complementary color. Click any swatch to make it the active color.
Yes. Click Save to Palette for each color you want to keep, then Export Palette to download a palette.css with all of them as CSS variables (--palette-1, --palette-2…). The active color is always --palette-1. The palette only lives on the page, so it's gone when you reload.
Further reading
Complete reference for every CSS color format, including HEX, RGB, HSL, and newer notations.
The official W3C guidance behind the minimum contrast ratios this tool checks against.
The formal spec covering every color model supported by modern browsers.
Related Tools
- Color Contrast Checker: WCAG AA/AAA & Color Blindness Design Check if text and background pass WCAG 2.2 AA and AAA, get the nearest passing text color and preview 4 types of color blindness. Free, in your browser.
- Color Scheme Generator: Complementary, Triadic & Analogous Design Pick a base color and get 5 harmonious colors: analogous, monochromatic, complementary, triadic or tetradic. Preview them on a site, export CSS or JSON.
- Color Palette from Image: Extract HEX, RGB & HSL Codes Design Upload a photo or logo and extract 3 to 12 dominant colors as HEX, RGB and HSL. Export CSS variables, Tailwind, JSON or PNG. Nothing leaves your browser.
- CSS Box Shadow Generator: Tailwind, Neumorphism & Glass Design Create CSS box shadows with a live preview and ready-made presets, or switch to neumorphism and glassmorphism. Copy as CSS, a Tailwind class or a variable.
- Flexbox Generator: CSS, Tailwind & React Code Design Build flex layouts with a live preview and 11 presets, set grow, shrink and order per item, then copy the code as CSS, Tailwind classes or React styles.