Home
Free • Instant • No Installation Required

CSS Unit & Color Converter

Convert between CSS color formats and units instantly. Free, fast, and developer-friendly.

Popular Converters — Color

HEX to RGB Converter

Convert HEX color codes to RGB format instantly.

Convert HEX to RGB →

RGB to HEX Converter

Convert RGB color values to HEX format instantly.

Convert RGB to HEX →

HEX to RGBA Converter

Convert HEX color codes to RGBA format with alpha channel.

Convert HEX to RGBA →

RGB to HSL Converter

Convert RGB color values to HSL format.

Convert RGB to HSL →

HSL to RGB Converter

Convert HSL color values to RGB format.

Convert HSL to RGB →

HEX to HSL Converter

Convert HEX color codes to HSL format.

Convert HEX to HSL →

RGBA to HEX Converter

Convert RGBA color values (with alpha) to HEX format.

Convert RGBA to HEX →

HSL to HEX Converter

Convert HSL color values to HEX format.

Convert HSL to HEX →

CSS COLOR NAME to HEX Converter

Convert CSS named colors to HEX codes.

Convert CSS COLOR NAME to HEX →

CSS COLOR NAME to RGB Converter

Convert CSS named colors to RGB format.

Convert CSS COLOR NAME to RGB →

CSS COLOR NAME to HSL Converter

Convert CSS named colors to HSL format.

Convert CSS COLOR NAME to HSL →

HEX to CSS COLOR NAME Converter

Find the CSS named color for a HEX code.

Convert HEX to CSS COLOR NAME →

HEX to CMYK Converter

Convert HEX color codes to CMYK format for print design and prepress workflows.

Convert HEX to CMYK →

RGB to CMYK Converter

Convert RGB color values to CMYK format for print-ready output and prepress.

Convert RGB to CMYK →

HEX to HSV Converter

Convert HEX color codes to HSV (HSB) format used in Photoshop and design tools.

Convert HEX to HSV →

HSV to HEX Converter

Convert HSV (HSB) color values to HEX format for web and CSS use.

Convert HSV to HEX →

OKLCH to HEX Converter

Convert OKLCH (CSS Color Level 4) values to HEX format for browser-compatible CSS.

Convert OKLCH to HEX →

HEX to OKLCH Converter

Convert HEX color codes to OKLCH format — the modern perceptually uniform color space.

Convert HEX to OKLCH →

TAILWIND CLASS to HEX Converter

Convert Tailwind CSS color classes like blue-500 or rose-400 to HEX codes instantly.

Convert TAILWIND CLASS to HEX →

LCH to HEX Converter

Convert CIE LCH color values to HEX format. LCH is a perceptually uniform color space ideal for consistent palettes.

Convert LCH to HEX →

HEX to LCH Converter

Convert HEX color codes to CIE LCH format — a perceptually uniform color space for predictable color manipulation.

Convert HEX to LCH →

LAB to HEX Converter

Convert CIELAB (L*a*b*) color values to HEX format for web-compatible CSS output.

Convert LAB to HEX →

HEX to LAB Converter

Convert HEX color codes to CIELAB (L*a*b*) — the device-independent color space used in color science.

Convert HEX to LAB →

HWB to HEX Converter

Convert HWB (Hue-Whiteness-Blackness) color values to HEX format. HWB is a CSS Color Level 4 format.

Convert HWB to HEX →

HEX to HWB Converter

Convert HEX color codes to HWB format — the intuitive Hue-Whiteness-Blackness color model from CSS Color Level 4.

Convert HEX to HWB →

Understanding CSS Colors and Units

HEX, RGB, and HSL Color Formats

CSS supports several color formats, each with unique advantages. <strong>HEX colors</strong> use a six-character hexadecimal notation (e.g., <code>#22c55e</code>) and are the most common format in web design due to their brevity. They represent red, green, and blue channels as pairs of hex digits ranging from 00 to FF.

<strong>RGB (Red, Green, Blue)</strong> uses decimal values from 0 to 255 for each channel. The format <code>rgb(34, 197, 94)</code> is more readable and allows easy manipulation of individual channels. RGBA extends this with an alpha channel for transparency control.

<strong>HSL (Hue, Saturation, Lightness)</strong> is the most intuitive for designers. Hue is a degree on the color wheel (0–360), while saturation and lightness are percentages. This makes it easy to create color variations — simply adjust lightness for tints and shades, or saturation for vibrancy.

CSS Named Colors

CSS provides 147 named colors like coral, steelblue, and rebeccapurple. While convenient for prototyping, named colors offer limited precision. Converting a CSS color name to HEX or RGB gives you exact values you can fine-tune for production use.

CMYK for Print Design

<strong>CMYK (Cyan, Magenta, Yellow, Key/Black)</strong> is the standard color model for print. Converting web colors from HEX or RGB to CMYK helps designers prepare assets for print production, ensuring color accuracy across digital and physical media.

HSV in Design Tools

<strong>HSV (Hue, Saturation, Value)</strong> — also called HSB (Hue, Saturation, Brightness) — is the native color model in tools like Adobe Photoshop, Figma, and Sketch. Converting between HSV and web formats bridges the gap between design tools and CSS code.

OKLCH — CSS Color Level 4

OKLCH (Lightness, Chroma, Hue) is the modern perceptually uniform color space introduced in CSS Color Level 4. Unlike HSL, OKLCH ensures that colors with the same lightness value actually appear equally bright to the human eye. It's supported in all modern browsers and is becoming the preferred format for design systems that need consistent, predictable color palettes.

LCH — CIE LCH Color Space

LCH (Lightness, Chroma, Hue) is the cylindrical representation of the CIELAB color space. It provides perceptually uniform color differences, meaning equal numerical changes produce visually equal differences. LCH is supported in CSS Color Level 4 via the lch() function and is widely used in color science, print workflows, and advanced design systems.

LAB — CIELAB Color Space

CIELAB (L*a*b*) is a device-independent color space that models human vision. L represents lightness (0–100), while a and b represent color-opponent dimensions (green–red and blue–yellow). LAB is the foundation for Delta E color difference calculations and is essential for color matching, print proofing, and scientific color analysis.

HWB — Hue Whiteness Blackness

HWB (Hue, Whiteness, Blackness) is a CSS Color Level 4 format designed to be more intuitive than HSL. You start with a hue, then add whiteness to lighten and blackness to darken. It's supported via the hwb() function in modern browsers and is particularly useful for creating tints and shades without complex math.

Tailwind CSS Colors

Tailwind CSS ships with a comprehensive color palette organized by name and shade (e.g., blue-500, rose-400). Converting Tailwind color classes to HEX codes is essential when integrating Tailwind designs with external tools, creating custom themes, or working with design tools that require hex values.

PX vs REM: CSS Units Explained

<strong>Pixels (PX)</strong> are absolute units — 1px is always 1/96th of an inch on screen. They provide pixel-perfect control but don't respond to user font-size preferences. <strong>REM</strong> units are relative to the root element's font size (typically 16px). Using REM ensures your layouts scale proportionally when users change their browser's default font size, improving accessibility.

The conversion is straightforward: divide pixels by 16 to get REM values. For example, 24px equals 1.5rem.

<strong>EM units</strong> are relative to the parent element's font size, unlike REM which references the root. This makes EM ideal for component-scoped sizing where elements should scale relative to their container rather than the page root.

  • 1rem = 16px (default browser setting)
  • 1em = parent font-size (context-dependent)
  • 0.75rem = 12px — common for small/caption text
  • 1.25rem = 20px — common for subheadings
  • 2rem = 32px — common for section headings

Why Use CSS Converters?

Manually converting between color formats is tedious and error-prone. Whether you're translating a designer's HEX values into HSL for CSS custom properties, or converting a pixel-based mockup into a REM-based responsive layout, automated conversion tools save time and eliminate mistakes.

  • Instant results — paste a value and get the converted output immediately, no formulas needed.
  • Copy-ready output — every result includes a one-click copy button with properly formatted CSS syntax.
  • Color preview — see a live swatch of the converted color to visually confirm accuracy.
  • No installation — works in any browser, on any device. No extensions, downloads, or signups.
  • Developer-friendly — shareable URLs with pre-filled values for easy team collaboration.

Common CSS Conversion Workflows

  • Design handoff: Figma and Sketch export colors as HEX. Convert to RGB or HSL if your codebase uses those formats.
  • Dark mode generation: Take your light-mode HSL palette, adjust lightness values, and convert back to HEX.
  • Accessibility checks: Convert colors to RGB to calculate contrast ratios using the WCAG luminance formula.
  • Legacy migration: Convert pixel-based layouts to rem-based responsive systems during refactors.
  • Cross-browser debugging: Quickly convert colors to match your source code format.

Supported Conversions

From To Category
HEXRGB, HSL, RGBA, CSS Name, CMYK, HSV, OKLCH, LCH, LAB, HWBColor
RGBHEX, HSL, CMYKColor
HSLHEX, RGBColor
RGBAHEXColor
CSS NameHEX, RGB, HSLColor
HSVHEXColor
OKLCHHEXColor
LCHHEXColor
LABHEXColor
HWBHEXColor
Tailwind ClassHEXColor
PXREM, EMUnit
REMPXUnit
EMPXUnit

FAQ

What is a HEX color?

A HEX color is a six-digit hexadecimal value preceded by a hash (#). Each pair of digits represents the red, green, and blue channels. For example, #FF0000 is pure red. Shorthand notation like #F00 is also valid.

How do I convert RGB to HEX?

To convert RGB to HEX, convert each decimal channel value (0–255) to its two-digit hexadecimal equivalent and concatenate them. For example, rgb(255, 128, 0) becomes #FF8000.

What is REM in CSS?

REM stands for 'root em' — a relative CSS unit based on the root element's font size. If the root font size is 16px (the browser default), then 1rem equals 16px. REM is preferred for responsive, accessible designs because it scales with user preferences.

Why use HSL over RGB?

HSL is more intuitive for color manipulation. Hue sets the base color, saturation controls vibrancy, and lightness adjusts brightness. This makes it easy to create color palettes, generate tints/shades, and maintain consistent design systems.