Color Converter

Runs 100% in your browser

Convert CSS colors between HEX, RGB, RGBA, HSL, HSV, CMYK, HWB, and OKLCH — alpha preview, WCAG contrast, 7 palette harmonies, CSS variable export, and private browser-only processing.

COLOR CONVERTER WORKSPACE

One color, every useful format

Paste a CSS color, choose one with the picker, and get synchronized HEX, RGB, HSL, HSV, CMYK, HWB, and OKLCH values with contrast and palette guidance.

Local only
STEP 1

Choose a color

Waiting
LIVE PREVIEW

Color swatch

HEX input
#5B3D8DContrast-ready preview
RGB 91, 61, 141Luminance —Alpha 1.00
STEP 2

Copyable color formats

Enter a valid color to see formats.

ACCESSIBILITY

Contrast checker

WCAG 2.2 guidance
Readable text preview
against background
against white
against black

Contrast appears after conversion. Alpha colors are composited over the selected background.

DEVELOPER OUTPUT

CSS variables

/* CSS output appears here */
STEP 3

Palette and harmony generator

Convert a color to generate a palette.

Private by architecture

Color conversion, contrast math, palette generation, and CSS output run in browser memory. No color value is uploaded or stored persistently.

Session only

Recent colors

Recent colors disappear when this page closes.

Frequently asked questions

A Color Converter translates a color between formats used in CSS, web design, development, accessibility, and print workflows. This workspace accepts common HEX, RGB/RGBA, HSL/HSLA, HSV, HWB, CMYK, and color-name inputs, then returns synchronized output values for every format instantly.

Paste a HEX value such as #5B3D8D or #5B3D8DAA into the input. The converter parses the red, green, blue, and optional alpha bytes and displays rgb() or rgba() output, along with HSL, HSV, CMYK, HWB, and OKLCH representations. Each format has its own Copy button.

Enter RGB syntax such as rgb(91 61 141), rgb(91, 61, 141), or an RGBA value with alpha. The converter clamps valid channel ranges, normalizes the result, and returns a six- or eight-digit HEX value when transparency is present. Both 3-digit shorthand and full 6-digit forms are produced.

HEX expresses channels as hexadecimal bytes, RGB expresses red, green, and blue channel values as decimal integers, and HSL expresses hue angle, saturation percentage, and lightness percentage. HEX and RGB are convenient for exact channel values, while HSL is easier for reasoning about lightness adjustments and generating shades or tints programmatically.

Yes. You can enter an eight-digit HEX value such as #5B3D8DAA, an rgba() form, or modern slash notation such as rgb(91 61 141 / 0.67). The Alpha slider updates to the parsed value, the swatch shows a checkerboard transparency preview, output formats preserve alpha where applicable, and contrast calculations composite the color over the selected background before comparing.

Yes. The tool recognizes common CSS color names such as red, rebeccapurple, deepskyblue, coral, gold, navy, transparent, hotpink, tomato, and others. For a complete named-color catalog, verify the output against the CSS specification or a browser.

HSV means hue, saturation, and value; HSB is another name for the same model used in many design tools including Figma, Adobe Photoshop, and Illustrator. HSV describes a color by its hue angle, color intensity, and brightness. It differs from HSL, whose final component is lightness rather than value.

CMYK represents cyan, magenta, yellow, and key/black ink percentages and is common in print workflows. A browser RGB or HEX color converted to CMYK is a mathematical approximation that depends on the intended print profile, paper, ink, and color-management workflow. Use a profile-aware application for production press output.

OKLCH is a perceptual color representation derived from OKLab, using lightness, chroma, and hue. It produces more visually consistent lightness and hue adjustments compared to HSL or RGB. The oklch() function is supported in Chrome 111+, Firefox 113+, Safari 15.4+, and Edge 111+. The displayed OKLCH value can be pasted directly into CSS oklch() calls.

HWB means hue, whiteness, and blackness. It is a CSS color model that describes a hue and how much white or black is mixed into it. The converter outputs an HWB value and preserves alpha when transparency is present. HWB is native in CSS via the hwb() function supported in all modern browsers.

Yes. It calculates contrast ratios for the current color against the selected background, white, and black, and labels each result as Fail, AA large, AA, or AAA using common WCAG contrast thresholds. Alpha colors are composited over the background before the ratio is calculated. Always verify the final text size, font weight, antialiasing, and composited background in the real interface.

Enter the foreground color, set the Background for contrast field to the intended surface, and read the ratio and WCAG label in the Accessibility panel. Use the live preview to inspect the pairing, then test normal text and large text separately in the actual design context.

Yes. Choose Complementary, Analogous, Triadic, Split complementary, Tetradic, Monochromatic, or Tints and shades from the harmony selector. Each generated swatch is clickable to reload it as the active color and recalculate all formats and contrast information.

The palette generator includes complementary, analogous, triadic, split-complementary, tetradic, monochromatic, and tint/shade schemes. These are starting points based on hue and lightness relationships; review them for contrast, brand meaning, and visual balance before committing to a palette.

Yes. Each format has its own Copy button, Copy all formats copies a readable key: value list, Copy CSS copies a ready-to-use :root variable block and example rule, and Download report saves a local text report with formats and contrast results.

Yes. The parser accepts comma-separated and modern space-separated RGB and HSL forms, including slash alpha notation such as rgb(91 61 141 / 0.7) and hsl(267 40% 40% / 70%). It also accepts HSV, HWB, and CMYK function forms.

The tool shows an explicit Invalid state and explains the supported color forms instead of producing guessed output. Correct missing #, channel values, percentages, parentheses, separators, or alpha syntax and run the conversion again.

No. HEX and RGB generally represent screen-oriented sRGB values, while CMYK depends on a print color profile and physical process. Use the CMYK value as a directional starting point and confirm with a profile-aware design or prepress application before production printing.

Yes. Parsing, conversion, contrast math, palette generation, and CSS output run locally in browser JavaScript. The workspace does not upload color values, call a remote color API, use persistent storage, or require an account. History is held only in memory for the current page session.

Yes. The workspace uses a responsive layout that stacks input, swatch, formats, contrast, CSS, and palette sections on narrow screens. The HTML color picker, text input, copy actions, and palette buttons remain keyboard- and touch-accessible.

No. It is a practical web color conversion and inspection tool. It does not model ICC profiles, monitor calibration, gamut mapping, print conditions, image pixels, or production color proofing. Use professional color-management software when those factors affect the deliverable.

Yes. Every color is shown as oklch(), oklab(), and lab() alongside HEX, RGB, HSL, HSV, HWB, and CMYK. The lab() output uses the D50 white point exactly as the CSS Color 4 specification defines, so the values paste directly into modern stylesheets.

OKLCH is perceptually uniform — equal numeric steps look like equal visual steps, and changing hue keeps perceived lightness stable. HSL lightness is distorted (yellow at 50% looks far brighter than blue at 50%), which is why modern design systems and CSS now prefer OKLCH for palettes.

What is Color Converter?

A Color Converter translates a CSS or design color into the formats developers and designers actually use: HEX, RGB, RGBA, HSL, HSV/HSB, CMYK, HWB, and OKLCH. It is useful for converting a hex color to RGB, generating CSS variables, checking an alpha color against a background, comparing accessible text contrast, and exploring a usable palette without switching between separate calculators.

Understanding Every Color Format — and When to Use Each

HEX (#RRGGBB / #RRGGBBAA) is the most common format in web development and design handoff. Each pair of hexadecimal digits encodes one color channel (0–255). An optional two-digit alpha suffix produces an 8-digit hex such as #5B3D8D86. Most design tools, color pickers, and CSS frameworks default to HEX. Three-digit shorthand (#RGB) is valid when each hex pair uses identical digits — for example #2244AA compresses to #24A.

RGB / RGBA expresses the same three channels as decimal integers from 0 to 255. Modern CSS accepts both the legacy comma form rgb(37, 99, 235) and the space-separated form rgb(37 99 235). Slash alpha notation rgb(37 99 235 / 0.7) is the current standard. Manipulating RGB channels numerically in JavaScript is fast because each channel is a plain integer.

HSL maps colors to a cylinder: hue angle (0–360°), saturation percentage (0–100%), and lightness percentage (0–100%, black to white). HSL is ideal for programmatic color manipulation — adjusting only the L value produces tints and shades of the same hue, and adding 180 to H produces the complementary color. Slash alpha notation hsl(221 83% 53% / 0.7) is the current CSS standard.

HSV / HSB uses hue, saturation, and value (brightness) rather than lightness. HSV is native to design software color pickers in Figma, Adobe Photoshop, and Illustrator. The saturation axis behaves differently from HSL and maps more naturally to how artists think about color intensity and brightness.

CMYK represents cyan, magenta, yellow, and key/black ink percentages. Print workflows generally require CMYK, but sRGB-to-CMYK conversion without an ICC color profile is a directional approximation. Use a profile-aware application for production press output.

HWB (hue, whiteness, blackness) is a CSS color model that describes a hue and how much white or black is mixed in. It is natively supported in all modern browsers via the hwb() function and maps intuitively to tinting and shading.

OKLCH is a perceptual color space using lightness, chroma, and hue derived from the Oklab model. Equal numeric changes correspond to roughly equal perceived color changes, making it better than HSL for generating accessible, consistent palettes. Supported in Chrome 111+, Firefox 113+, Safari 15.4+, and Edge 111+.

Alpha, WCAG Contrast, and Accessibility Checks

Alpha transparency complicates color accessibility because the effective color depends on the background it is composited over. This converter parses alpha from 8-digit HEX, rgba(), modern slash notation, and the alpha slider, then composites the color over the selected background using the standard Porter-Duff over operation before computing the WCAG relative luminance and contrast ratio. The panel reports the ratio against the selected background, white, and black, and labels each Fail, AA large, AA, or AAA.

WCAG 2.1 requires a 4.5:1 contrast ratio for Level AA on normal text, and 3:1 for large text (18pt+ or 14pt+ bold). Level AAA requires 7:1. Accessibility decisions should still be verified against actual text size, weight, antialiasing, and real UI layout context — this tool provides a directional check, not a substitute for a full audit.

The CSS custom property block generated by the converter outputs --color-primary (HEX), --color-primary-rgb (modern RGB), --color-primary-hsl (HSL), and --color-primary-cmyk (CMYK), plus an example .example rule using rgba() and background-color. Paste this into your :root {} selector to create a typed design token and derive tints and shades using hsl() with individual channel variables.

Common use cases

  • Converting a HEX brand color to RGB, RGBA, HSL, HSV, CMYK, HWB, and OKLCH for use in different design and development contexts
  • Parsing CSS color functions such as rgb(), rgba(), hsl(), hsla(), hsv(), hwb(), and cmyk() and normalizing to a consistent format
  • Checking how an alpha or transparent color composites over a white, black, or custom background for WCAG contrast compliance
  • Testing WCAG contrast ratios and AA/AAA labels for a foreground/background pairing before shipping a UI component
  • Generating complementary, analogous, triadic, split-complementary, tetradic, monochromatic, tint, and shade palettes from a single color
  • Creating copy-ready CSS custom properties and example color declarations for a design token baseline
  • Finding a color value from the native picker with eyedropper and reusing a generated palette swatch for rapid color exploration
  • Comparing screen-oriented sRGB output with a directional CMYK approximation before a print handoff
  • Exploring OKLCH output for perceptually consistent lightness, chroma, and hue design work in modern CSS

Why use ToolsSonic's Color Converter?

ToolsSonic's Color Converter combines the broad format coverage demonstrated by W3Schools and ColorHexa, the practical HEX/RGB/HSL/CMYK flow of RapidTables and ConvertAColor, and the alpha, harmony, and contrast ideas visible in Colorizer. The dedicated workspace provides a modern unified input, native picker, alpha slider, checkerboard swatch, synchronized eight-format output, copy buttons, WCAG ratio cards, custom-background comparison, CSS variable export, seven palette schemes, random/sample actions, mobile stacking, explicit invalid-input diagnostics, and session-only history.

vs. W3Schools Color Converter: W3Schools is a familiar educational reference with a basic color picker and a few output formats. It does not provide synchronized copy-per-format output, alpha support, WCAG contrast against a custom background, palette harmonies, CSS variable export, or explicit error states. ToolsSonic addresses every one of these gaps in a single focused workspace.

vs. ColorHexa: ColorHexa provides extensive color-information coverage including harmonies, shades, and gradients, but requires a full page reload per color search. It is a color encyclopedia, not a developer action workspace. ToolsSonic updates all eight output formats on every keystroke, shows WCAG contrast inline, and exports CSS without any page navigation.

vs. RapidTables Color Converter: RapidTables uses separate input rows for each format and separate Convert buttons. It does not support HWB, OKLCH, RGBA alpha, custom contrast background, palette generation, CSS export, or download. ToolsSonic replaces separate conversion forms with one synchronized parser.

vs. ConvertAColor: ConvertAColor offers a compact unified flow with per-format copy controls. It does not support HWB, OKLCH, alpha-aware CSS syntax, WCAG contrast, custom background, palette harmonies, download, or privacy boundaries. ToolsSonic adds all of these while matching the copy-per-format convenience.

vs. Colorizer: Colorizer is feature-rich but uses a legacy interface. ToolsSonic retains the highest-value behaviors — alpha compositing, contrast pairing, harmony palettes — in a clean modern layout with session-only history, CSS variable output, accessible labels, and mobile stacking.

Privacy guarantee: Open DevTools → Network tab. Enter any color. You will see zero outbound requests. Every color calculation happens entirely in your browser using vanilla JavaScript with no external libraries.

Color Format Reference

FormatExampleCSS UsageBest For
HEX#5B3D8Dcolor: #5B3D8DDesign files, static stylesheets, copy-paste from Figma/Sketch
HEX 8 (alpha)#5B3D8DAAcolor: #5B3D8DAAWhen alpha must be encoded in a hex literal
RGB (modern)rgb(91 61 141)color: rgb(91 61 141)JS color manipulation, modern stylesheets
RGBArgba(91, 61, 141, 0.67)color: rgba(91,61,141,.67)Legacy rgba() with alpha transparency
HSLhsl(267.6 39.5% 39.6%)color: hsl(267.6 39.5% 39.6%)Tint/shade generation, theming, animation
HSVhsv(267.6 56.7% 55.3%)Not native CSSDesign tool color pickers (Figma, Photoshop)
CMYKcmyk(35.5% 56.7% 0% 44.7%)Not native CSS; for printPrint design, brand guidelines (approximate)
HWBhwb(267.6 23.9% 44.7%)color: hwb(267.6 23.9% 44.7%)Intuitive tinting and shading, modern CSS
OKLCHoklch(35.14% 0.0944 281.2deg)color: oklch(35.14% 0.0944 281.2deg)Perceptual palette generation, Chrome/Firefox 111+

ToolsSonic Color Converter vs Competitors

FeatureToolsSonicW3SchoolsColorHexaRapidTablesConvertAColor
FormatsHEX, RGB, RGBA, HSL, HSV, CMYK, HWB, OKLCHHEX, RGB, HSL, HWB, NColMany (no HWB, no OKLCH)HEX, RGB, HSV, HSLHEX, RGB, HSL, CMYK
Alpha / transparency✅ 8-digit HEX + slider + alpha composite
Real-time input✅ Every keystroke❌ Page reload per color❌ Separate Convert buttons
WCAG contrast check✅ vs bg + white + black, alpha composite✅ (partial)
CSS variable export✅ :root block + example rule
Palette harmonies✅ 7 schemes, clickable swatches✅ (page reload)Similar colors only
Download report✅ Local .txt, no upload
Fully local (no upload)❌ Server-rendered❌ Server-rendered
100% private — runs in your browser Instant — no server round-trip Free forever — no account needed

Hex Converter

Editor's choice

Convert text to UTF-8 or Latin-1 hexadecimal bytes and decode hex back to text — configurable separators, 0x prefix, uppercase or lowercase, byte preview, strict validation, round-trip check, local file input, and private browser-only processing.

CSS Minifier

Editor's choice

Minify CSS locally with protected strings, URLs, data URLs, custom properties, calc expressions, safe color and zero-unit reductions, byte savings, diagnostics, history, copy, and download.

HTML Editor

Editor's choice

Edit HTML with a live preview — synchronized source editor, WYSIWYG visual pane, sandboxed preview, 5 starter templates, format, minify, validate, find/replace, file import, and download. 100% in your browser.

Regex Tester

Editor's choice

Test JavaScript regular expressions against any sample text — every match highlighted, capture groups listed, named groups resolved, replace preview, all flags, pattern history, and a quick-reference cheat sheet. Free, 100% browser-local.

Base64 Encode

Editor's choice

Encode UTF-8 text and local files to standard or URL-safe Base64 with optional padding, line wrapping, Data URI prefixes, byte statistics, and browser-only processing.

URL Encoder

Editor's choice

Encode URL components, query values, path segments, form data, or complete URIs locally with UTF-8 percent encoding, + space handling, delimiter preservation, and a URL analyzer.