Tools

Convert Color Codes: HEX, RGB, HSL and CMYK

Paste a HEX, RGB or HSL value, or a CSS color name, and get the same color in every format, ready to copy.

Advanced Options


Need to turn a HEX code into RGB for your CSS, or an RGB value from a design file into HEX? Paste the color in any format and the converter shows it as HEX, RGB, HSL and CMYK at once, with a live preview. You can also paste a list of colors and convert them in one go.

Every conversion happens in your browser, so it's fast and keeps working offline once the page has loaded. Alpha values are supported, and the contrast ratio tells you whether text in that color will be easy to read.

More Than a HEX to RGB Converter

  • Batch conversion for several colors at once
  • Gradient preview with a ready-to-copy CSS snippet
  • Alpha and opacity support, including 8-digit HEX
  • Contrast ratio for accessibility checks
  • Color harmony suggestions

Why Color Conversion Matters

Design tools, browsers and printers all describe color differently. Converting accurately keeps a brand color the same in Figma, in your CSS and on paper, and saves you from doing the math by hand. convert JSON, CSV, and XML data formats.

Frequently Asked Questions

Paste the HEX code, for example #1E90FF, into the box and the RGB value appears right away: rgb(30, 144, 255). Each pair of HEX digits is one channel (red, green, blue) written in base 16, so 1E is 30, 90 is 144 and FF is 255.

Paste the RGB value, for example rgb(30, 144, 255), and copy the HEX code: #1E90FF. Each channel from 0 to 255 becomes two hexadecimal digits: 30 is 1E, 144 is 90 and 255 is FF.

HEX, RGB, RGBA, HSL, HSLA, CMYK and standard CSS color names.

Yes. Turn on batch mode and paste several colors separated by commas, spaces or line breaks.

Yes. Include an alpha value with RGBA or HSLA, or export HEX with alpha as an 8-digit code.

No. All conversions happen in your browser, and nothing is saved or sent anywhere.

How to Use the Color Converter

  1. Enter your color value
    Type or paste any color value — HEX (#3b82f6), RGB (59, 130, 246), HSL (217, 91%, 60%), or CMYK. The tool auto-detects the format.
  2. See every format at once
    All equivalent formats update in real time: HEX, RGB, RGBA, HSL, HSLA, HSV, CMYK, and CSS custom property. Copy any value with a single click.
  3. Use the color picker
    Click the color swatch or use the native browser color picker to visually choose a color and get all its format equivalents at once.
  4. Copy and use in your project
    Click any format's copy button to send it to your clipboard. Paste directly into CSS, Sass, Tailwind config, Figma, or print workflows.

Example Conversions

The same blue color expressed in every supported format:

FormatValueUsage
HEX#3b82f6CSS, HTML, Figma
RGBrgb(59, 130, 246)CSS, Canvas API
RGBArgba(59, 130, 246, 1)CSS with opacity
HSLhsl(217, 91%, 60%)CSS, design tokens
CMYKC:76 M:47 Y:0 K:4Print / offset
HSV217°, 76%, 96%Image editors

Common Use Cases

Web & UI Design

Convert brand HEX colors to HSL for CSS custom properties and Tailwind config, ensuring consistent theming across light and dark modes.

Print & Pre-press

Convert screen RGB or HEX colors to CMYK for print production — avoiding the common pitfall of colors that look great on screen but print dull.

Brand Guidelines

Document a complete brand palette in all formats — HEX for digital, CMYK for print, Pantone reference — from a single source of truth.

Accessibility Checks

Retrieve exact color values to test in a contrast checker, ensuring text and background combinations meet WCAG AA or AAA requirements.

Developer Workflows

Quickly translate design-tool colors (Figma HEX) into CSS HSL variables for dynamic theming and programmatic color manipulation.

How It Works

All conversions run in your browser, with no server involved.

Color Parsing
The tool parses your input into normalised RGB values (0–255 per channel), then applies standard conversion formulas to each target format.
HEX ↔ HSL Conversion
HSL (Hue, Saturation, Lightness) is derived from RGB by finding the min/max channel, computing lightness as their average, then calculating saturation and hue angle.
CMYK Approximation
CMYK is computed from RGB via the formula: K = 1 - max(R,G,B); C = (1-R-K)/(1-K); etc. Note that RGB→CMYK is device-dependent — screen CMYK is an approximation, not a press profile.

Who This Tool Is For

Frontend Developers

Translate design tokens between CSS formats and quickly verify color values during development.

UI/UX Designers

Convert Figma or Sketch swatches to any format needed by your design system or CSS framework.

Print Designers

Convert RGB brand colors to CMYK before sending artwork to press, preventing color shift surprises.

Brand Managers

Maintain a single brand palette in all formats — digital and print — without switching tools.

Accessibility Testers

Extract precise color values for use in contrast checkers and accessibility audits.

Tips for Working with Colors

  • Use HSL in CSS custom properties (--color-primary: hsl(217, 91%, 60%)) so you can adjust lightness with calc() for hover and disabled states.
  • Always request a press proof when using CMYK conversions from RGB — screen-to-print color matching requires a device color profile.
  • Use the browser color picker to sample colors directly from screenshots or design assets — no need to copy values manually.
  • After converting, test your colors in a contrast checker to confirm your palette meets WCAG AA (4.5:1) for body text.
  • Store your brand palette in all formats (HEX, RGB, CMYK) in your design system documentation to eliminate repeated conversions.

Why Accurate Color Conversion Matters

  • Inconsistent color values across design and development teams are one of the leading causes of visual inconsistency in shipped products.
  • RGB and CMYK occupy different gamuts — colors that look vibrant on screen can appear muddy in print without a proper conversion.
  • CSS HSL makes dynamic theming (light/dark mode, tints) far easier than HEX — but requires accurate HEX-to-HSL conversion to start.
  • Brand compliance audits require colors in multiple formats — a single converter eliminates manual errors and saves hours of back-and-forth.

Performance & Privacy

Every color conversion runs entirely within your browser using vanilla JavaScript. No color value, palette, or usage data is ever sent to any server. The tool responds in under 10 ms per conversion, works offline after the first visit, and requires no account or registration.

Educational Note: Color Spaces Explained

RGB (Additive)

RGB mixes red, green, and blue light. All channels at 255 = white; all at 0 = black. Used by screens, cameras, and web browsers.

HEX (Web Shorthand)

HEX is RGB encoded as base-16. #3b82f6 = R:59, G:130, B:246. It is identical to RGB — just a more compact notation for CSS and HTML.

HSL (Perceptual)

HSL separates hue (color wheel angle 0–360°), saturation (intensity), and lightness (brightness). Easier to reason about than RGB for designers.

CMYK (Subtractive)

CMYK mixes Cyan, Magenta, Yellow, and Key (black) ink. It subtracts from white paper. Screen RGB has a wider gamut — some bright RGB colors cannot be reproduced in CMYK.

Troubleshooting

Screen-to-CMYK conversion is mathematically approximate. For professional print, use a calibrated ICC color profile in a program like Adobe Illustrator or Photoshop.

Use the RGBA output instead. 8-digit HEX (#3b82f6cc) is supported by modern browsers but not all tools — RGBA is safer and more widely compatible.

Browser color pickers are limited to the sRGB gamut. Wide-gamut colors (P3, Rec2020) will be clamped to the nearest sRGB equivalent.

Figma uses HSB (also called HSV), not HSL. The tool also outputs HSV — check that column for a direct match.

Did You Know?

HEX color notation was introduced to HTML in 1996 with the HTML 3.2 specification. Before that, browsers only recognised 16 named colors (like "red" and "blue"). The full web color palette expanded to 140 named colors with CSS1, but HEX remained the dominant format — and still is, more than 25 years later.

Convert Any Color Code

Whether you're turning Figma tokens into CSS, matching a brand color for print, or checking contrast for accessibility, paste the color, copy the format you need and get back to work. Conversions run in your browser and nothing is stored.