Skip to main content

Hex Color Converterv1.0.0

Convert hex color codes to and from RGB, RGBA, CMYK, and a named reference swatch with a live color preview. Each conversion runs bidirectionally, and a nearest-swatch lookup matches input colors against a generated 1,354-entry reference palette using Euclidean distance in RGB space, reporting how far off the match is.

Runs entirely in your browser

This tool sends nothing over the network. Everything you enter is processed on your device and never reaches our servers.

Color Theory
Web Development
Print Design
Graphic Design
Loading the tool
Reference

Documentation

Select an input mode to specify which color format you want to convert from. The converter supports five inputs: Hex, RGB, RGBA, CMYK, and a named reference swatch. After entering a color value in the chosen format, click Convert or wait for the automatic conversion to process your input. All other formats update simultaneously, and a color preview swatch renders the resulting color inline with the output values.

  • Choose Hex mode and enter a six-digit hexadecimal code with or without the leading hash symbol. Three-digit shorthand codes such as #F0C expand automatically to their six-digit equivalents. Both uppercase and lowercase letters are accepted.
  • Choose RGB mode and enter integer values from 0 to 255 for each of the Red (R), Green (G), and Blue (B) channels. Fractions like 127/2 and mixed numbers like 63 1/2 are parsed and clamped to the valid range.
  • Choose RGBA mode to specify RGB channels plus an Alpha (A) transparency value between 0 and 1. An alpha of 0 is fully transparent and 1 is fully opaque. Decimal values such as 0.5 set partial transparency.
  • Choose CMYK mode and enter percentage values from 0 to 100 for Cyan (C), Magenta (M), Yellow (Y), and Key/Black (K). The conversion uses the standard formula: R = 255 * (1 - C/100) * (1 - K/100), with equivalent calculations for the green and blue channels.
  • Choose Reference swatch mode and type a swatch name into the search field. The datalist narrows suggestions as you type. Names follow a fixed pattern of hue family, chroma tier, and tone, so Azure 500 is the mid tone of the azure family at standard chroma and Cool Grey 800 is a dark neutral. Select one to convert it to all other formats.
  • Review the Results section for all converted values. The color preview swatch shows the visual representation. Each output line displays the format label followed by the computed value.
  • Open Settings to toggle uppercase or lowercase hex output and adjust the number of decimal places shown in CMYK percentage values.
  • Click Reset to clear all inputs, remove saved state, and restore the default color values. All settings return to their defaults as well.
  • All input values and settings persist automatically between sessions using browser local storage. Returning to the page restores the most recent conversion.

This converter does not look up proprietary spot color systems. Pantone, RAL, NCS, HKS, TOYO, and DIC all license their color libraries commercially and their screen values are not free to redistribute, so there is no lookup by PMS number or equivalent code here and none is planned.

Converting one is still straightforward. If you hold a licensed swatch book or a subscription that gives you the sRGB or hex value for a proprietary color, enter that value in Hex or RGB mode. Every output you get back is exact, because the maths runs on the value you supply rather than on a stored table. Only the lookup step is missing, and that step is the part nobody may redistribute.

The reference swatch list is generated, not sampled from any commercial system. Its 1,354 entries are spaced evenly in the OKLCH perceptual color space across 24 hue families, five chroma tiers, and eleven tones, plus three neutral ramps. It is built for browsing and for constructing tints and shades, and it makes no attempt to approximate a licensed library. Whenever the tool names a closest swatch it prints the distance beside it, so the label is never mistaken for a match.

Color format conversion is a routine task across multiple disciplines where different tools and output media require specific color notations. Converting between hex, RGB, RGBA, CMYK, and a named swatch bridges the gap between screen-based and print-based workflows.

  • Web Development: Extract an RGB or RGBA value from a design mockup and convert it to a hex code for CSS stylesheets. Enter rgb(52, 152, 219) channel values to get #3498DB for use in background-color, border, or gradient declarations.
  • Print Design: Convert a hex brand color to CMYK percentages before sending artwork to a commercial printer. A web color of #E74C3C translates to approximate CMYK values that a prepress technician can verify against the print profile.
  • Brand Guidelines: Document a brand palette in every required format. Enter each brand color once and record the hex, RGB, and CMYK values in a single conversion step, ensuring consistency across digital and physical media.
  • UI and UX Design: Adjust transparency for overlay elements by converting an RGB color to RGBA with a specific alpha value. Set the alpha to 0.85 for a semi-transparent navigation bar background and copy the RGBA output directly into a design tool or stylesheet.
  • Illustration and Digital Art: Recreate a physical illustration in a digital canvas application by entering the spot color value from your own swatch book and reading off the hex or RGB output for the color picker.
  • Email Marketing: Convert brand colors to hex codes that render consistently across email clients. Many email rendering engines support only hex notation, so converting from RGB or CMYK to hex ensures the intended color appears in the inbox.
  • Accessibility Auditing: Convert colors between formats to calculate contrast ratios. Enter foreground and background colors in any supported format, then use the hex or RGB output in a contrast checker to verify WCAG compliance.
Inputs, outputs, and what the Hex Color Converter computes

The form above accepts the following inputs and produces the outputs listed below. This summary is rendered in the page so the parameters are visible to crawlers, assistive tech, and indexing agents that don't fetch the embedded tool frame.

Inputs

  • Hex · default: hex
  • RGB · default: rgb
  • RGBA · default: rgba
  • CMYK · default: cmyk
  • Reference swatch · default: swatch
  • Hex Code (text input) · default: #3498DB
  • Red (R) (text input) · default: 52
  • Green (G) (text input) · default: 152
  • Blue (B) (text input) · default: 219
  • Red (R) (text input) · default: 52
  • Green (G) (text input) · default: 152
  • Blue (B) (text input) · default: 219
  • Alpha (A) (text input) · default: 1
  • Cyan (C) % (text input) · default: 76
  • Magenta (M) % (text input) · default: 31
  • Yellow (Y) % (text input) · default: 0
  • Key/Black (K) % (text input) · default: 14
  • Swatch Name (text input)
  • Uppercase hex output
  • CMYK decimal places · default: 2

Controls

Convert · Reset

Worked example

After entering a color value in the chosen format, click Convert or wait for the automatic conversion to process your input.