Developer

Color Code Converter

Paste a HEX, RGB, HSL, or CSS color name and convert it to every other color format.

Developer

Why Use the Color Code Converter?

Paste a color in whatever format you have and this color code converter returns every other format at once: HEX, RGB, HSL, HSV, CMYK, a CSS custom property and the nearest named color. It is built for the moment when a brand guide, a design file and a codebase all describe colors differently. Instead of running separate one-way converters, you get one consistent set of values to copy into CSS, design tools or documentation. It reads HEX, rgb(), hsl() or plain CSS names like steelblue.

How to Use the Color Code Converter

  1. Paste or type your color into the text field, for example #2A9D8F, rgb(42, 157, 143), an hsl() value or a name such as teal.
  2. Prefer to start visually? Use the color picker beside the field and the text value fills in for you.
  3. Read down the results: HEX, RGB, HSL, HSV and CMYK all update together, along with the nearest CSS color name.
  4. Click Copy on the format your destination needs, such as HSL for a theme file or the CSS custom property for a :root block.

Best For

  • Turning RGB values from a brand guidelines PDF into HEX codes for a website stylesheet.
  • Converting HEX colors from an existing codebase into HSL so hover states can be built by adjusting lightness.
  • Translating a color name used in a quick prototype, such as tomato, into a precise value for production code.
  • Confirming that a color written in different formats across Figma, CSS and documentation is really the same color.

Pro Tip

Converting back and forth between formats can introduce small rounding drift, because HSL and CMYK are usually shown as rounded whole percentages while HEX and RGB store exact whole numbers from 0 to 255. Pick one format as the source of truth for your design tokens, usually HEX or RGB, and always derive the other formats from it instead of converting an already converted value a second time.

FAQ

Color Code Converter FAQ

How do I convert RGB to HSL?

Divide R, G and B by 255 and find the largest (max) and smallest (min) of the three. Lightness is (max + min) / 2; if max equals min the color is a gray with 0% saturation, otherwise saturation is (max - min) / (1 - |2L - 1|). Hue is an angle based on which channel is largest, counting from 0 degrees for red, 120 for green and 240 for blue. The converter does all of this instantly.

How do I convert HEX to CMYK?

First turn the HEX code into RGB and divide each channel by 255. Black (K) is 1 minus the largest of those values, and each of C, M and Y is (1 - channel - K) / (1 - K). Pure red #FF0000, for example, becomes C 0%, M 100%, Y 100%, K 0%. Treat the result as a starting point, since real print output depends on the printer's color profile.

Are HEX and RGB the same color?

Yes. HEX and RGB are two notations for the same sRGB color: HEX writes each of the red, green and blue channels as a two-digit base-16 number, while rgb() writes them as decimals from 0 to 255. #FFA500 and rgb(255, 165, 0) are the same orange, and browsers render them identically.

Which color format is best for CSS?

All modern browsers understand HEX, rgb() and hsl(), so the choice is about convenience. HEX is compact and common in design handoff, while hsl() is the easiest to adjust by hand because you can change lightness or saturation without touching the hue. Many teams store tokens in HEX and switch to hsl() when building lighter or darker variations.

Learn more

Guides for the Color Code Converter

RGB vs CMYK: Why Your Colors Look Different in Print

RGB vs CMYK explained: why screen colors shift in print, what gamut means, why quick RGB to CMYK formulas are only estimates, and a print-safe color workflow.

Read Guide

HEX, RGB, and HSL Color Codes Explained Simply

Understand what HEX, RGB, HSL, HSV, and CMYK color codes actually mean, when to use each, and how to convert between them with confidence.

Read Guide

How to Convert HEX to RGB (and RGB to HEX) Step by Step

Learn how to convert HEX to RGB and back by hand with worked examples, the RGB to HEX formula, shorthand and 8-digit codes, plus copy-ready JavaScript.

Read Guide
Copied