Skip to main content

CSS Color Format Converter — HEX, RGB, HSL, OKLCH, CSS Variable & Tailwind

Convert any color between HEX, RGB, HSL, OKLCH, CSS variable, and Tailwind — with live preview.

  • Runs locally
  • Category Color & Design
  • Best for Moving from a visual idea to reusable color values.
Pick a color
Detected:hex
Preview
HEX
RGB
HSL
OKLCH
CSS Var
Tailwind

What this tool does

Paste any CSS color in HEX, RGB, HSL, or OKLCH format and instantly see every other representation side-by-side: a hex string, rgb() and hsl() function calls, the modern oklch() form (CSS Color Level 4), a ready-to-paste CSS custom property, and a Tailwind arbitrary-value class. A colour picker lets you visually choose any shade, and a live preview swatch confirms the result at a glance. The CSS variable name and the Tailwind class prefix (bg, text, border, ring, fill, stroke) are both editable so you can copy the exact line you need. Every value has its own copy button. The tool auto-detects the input format so you never have to specify it manually. All conversions run client-side with no server round-trip.

Tool details

Input
Text + Numbers + Structured content
The page exposes text boxes, numeric controls, file pickers, or structured inputs depending on the tool.
Output
Live result + Copy + Preview
The result area focuses on usable output, with copy, download, or preview actions when supported.
Privacy
Browser-side processing
The main tool logic does not call an external API, so inputs normally stay in the current tab.
Save / share
Shareable URL state
Key settings are encoded in the URL so another person can reopen the same setup.
Performance budget
Initial JS <= 22 KB
No WASM budget is declared, keeping the tool quick to open on mobile.
Best fit
Color & Design · Developer
Category and role tags drive related tools, internal links, and quick fit checks.

How to use

  1. 1. Input

    Paste or drop your content into the tool panel.

  2. 2. Process

    Click the button. All processing is local in your browser.

  3. 3. Copy / Download

    Copy the result or download to disk in one click.

How CSS Color Format Converter fits into your work

Use it while choosing, checking, converting, or documenting colors for real interface work.

Color jobs

  • Moving from a visual idea to reusable color values.
  • Checking contrast and accessibility before a UI ships.
  • Keeping brand, design, and implementation color decisions aligned.

Color checks

  • Verify contrast against the actual background, not just a sample swatch.
  • Check dark and light themes separately when both exist.
  • Copy the final format your design system or codebase expects.

Good next steps

These links move the current task into a more complete workflow.

  1. 1 Color Converter HEX ⇄ RGB ⇄ HSL ⇄ HSV ⇄ CMYK — instant 5-way conversion, live swatch — browser-only Open
  2. 2 CSS Gradient Generator Visual CSS gradient builder — linear, radial, conic with multi-stop colors, live preview, copy CSS, PNG export. Open
  3. 3 CSS Formatter & Minifier Format and beautify CSS — sort properties, indent rules, expand or minify. Open

Real-world use cases

  • Copying a Figma color into CSS as oklch()

    You pick a swatch in Figma, get a hex code like #7c3aed, and need it as oklch() for a CSS Color Level 4 stylesheet. Paste the hex here, read oklch(0.4457 0.2457 293.8) from the OKLCH row, and copy it straight into your :root block — no manual matrix math needed.

  • Building a Tailwind v4 design token file

    Tailwind v4 lets you theme via CSS variables using oklch. You have a brand palette in hex and need to fill in --color-primary through --color-accent. For each swatch paste the hex, grab the CSS variable row (customising the variable name), and build your tokens.css in seconds instead of converting each colour by hand.

  • Checking whether a designer's oklch() value renders correctly

    A designer sends oklch(0.72 0.15 200) in a spec doc. You paste it into the input, see the hex, RGB, and HSL equivalents alongside the preview swatch, and instantly verify it is indeed that teal-green shade before wiring it up in code.

Common pitfalls

  • Pasting oklch() with percentage lightness (oklch(72% 0.15 200)) instead of the 0–1 decimal form — the input accepts both but the output always uses the 0–1 form per the CSS Color Level 4 spec.

  • Setting the CSS variable name with spaces or invalid chars; use lowercase letters, digits, and hyphens only (e.g. color-brand-primary).

  • Expecting Tailwind arbitrary-value classes (bg-[#hex]) to override a global CSS variable you set elsewhere — they have equal specificity, so the one that appears later in the stylesheet wins.

Privacy

All color conversions run entirely in your browser — no color value you enter is ever sent to a server. The current color is encoded in the URL only when you share the link, so sensitive brand colors stay off the network by default.

FAQ

Tool combos

Folks in your role tend to reach for these alongside this tool.

Made by Toolora · 100% client-side · Updated 2026-07-01