Skip to content

CSS Color Format Converter

Free

Convert between HEX, RGB, RGBA, HSL, HSLA, HSB, and CMYK. Paste any CSS color value and get all formats instantly. Free, browser-based.

convert css color formatscolor format converterhex rgb hsl converter
All Color Tools

Settings guide

Supported input formats:

FormatExample input
HEX 6-digit#FF5733 or FF5733
HEX 3-digit shorthand#F53
HEX 8-digit with alpha#FF573380
RGBrgb(255, 87, 51)
RGBArgba(255, 87, 51, 0.5)
HSLhsl(217, 91%, 60%)
HSLAhsla(217, 91%, 60%, 0.5)
CSS named colordodgerblue, red, cornflowerblue
Modern space syntaxrgb(255 87 51)

When each output format is most useful:

  • ·HEX — Stylesheets, Figma/Sketch exports, Tailwind config
  • ·RGB — JavaScript Canvas API, Three.js, some CSS-in-JS
  • ·HSL — CSS variables with programmatic manipulation, dark mode tokens
  • ·CMYK — Passing color context to print designers (approximation)
  • ·HSB — Photoshop, Illustrator color pickers

Format comparison

Format compatibility in CSS: HEX, RGB, and HSL work in all browsers back to IE9+. OKLCH and Display-P3 require modern browsers (2022+). For maximum compatibility, use HEX or RGB. For design system work, HSL custom properties are worth the slight verbosity for the manipulation benefits.

Choosing the right format for a project: Use HEX for final CSS values in most projects — it's compact and universally understood. Use HSL for design token files where you want the palette to be self-documenting (the hue and lightness relationship is obvious). Use RGB when interfacing with JavaScript APIs that require separate channel values.

What this converter does not support: ICC-profile-accurate conversions, wide-gamut formats (Display-P3, Rec.2020) beyond basic OKLCH, or color spaces outside the sRGB gamut. For print-production-quality conversions, use a dedicated color management tool.

How it works

1

Paste color

Enter any CSS color value — HEX, rgb(), hsl(), or a named CSS color like 'tomato'.

2

Auto-detect

The tool identifies the input format and parses it to an internal RGB representation.

3

Copy any format

All output formats appear simultaneously — click any one to copy it to your clipboard.

About this format

CSS supports seven distinct color formats: named colors (red, dodgerblue), HEX (#FF5733), RGB (rgb(255, 87, 51)), RGBA (rgba(255, 87, 51, 0.5)), HSL (hsl(217, 91%, 60%)), HSLA (hsla(217, 91%, 60%, 0.5)), and the modern Color Level 4 syntax (oklch, lab, display-p3). Different contexts demand different formats — a design tool exports HEX, a CSS animation needs HSL for manipulation, a canvas API needs RGB integers, print workflows need CMYK.

This converter accepts any format as input and outputs all others simultaneously. Paste any valid CSS color string and immediately see the equivalent in every format — no need to chain multiple single-purpose converters.

The converter also handles CSS named colors (paste "dodgerblue" or "cornflowerblue" and get all numeric equivalents), and accepts both legacy comma syntax (rgb(255, 87, 51)) and modern space syntax (rgb(255 87 51)) for HSL and RGB functions.

Frequently asked questions

Which CSS color format should I use in my stylesheet?+
HEX for most projects — it's compact and universally supported. HSL for design systems where you want semantic control (change lightness without touching hue). RGB/RGBA when you need inline transparency without HSL. There's no performance difference between formats — browsers normalize them all internally.
Do CSS named colors have exact HEX equivalents?+
Yes. All 140 CSS named colors map to exact HEX values. 'dodgerblue' is #1E90FF, 'tomato' is #FF6347, 'cornflowerblue' is #6495ED. This converter shows the HEX equivalent for any named color you paste.
What is the difference between the old and new CSS color syntax?+
Old: rgb(255, 87, 51) with commas. New (CSS Color Level 4): rgb(255 87 51) with spaces. Both work in all modern browsers. The new syntax also uses a slash for alpha: rgb(255 87 51 / 0.5) instead of rgba(255, 87, 51, 0.5). Stick with the comma syntax for maximum compatibility.
Can I convert CSS custom properties (CSS variables) with this tool?+
No — CSS custom properties like var(--primary) are resolved at runtime by the browser. This tool works with static color values. To convert a CSS variable, inspect it in browser DevTools to find the resolved value, then paste that resolved value here.
Is CMYK output accurate for print use?+
The CMYK output is a formula-based approximation without ICC profile correction. It's suitable for communicating a color to print designers, but should not be used for production print color management. Request the official Pantone or CMYK value from your brand guide for print work.

Related tools and guides