🎨 Color Converter

A free online color converter — a color companion for front-end developers and designers. The system color picker and the HEX field are linked both ways: drag the picker to choose a color and all three formats update live; type a HEX value in the field (shorthand like #fff works), and the picker and preview follow along. HEX, RGB, and HSL values each get their own row with an independent copy button, plus a large swatch previewing the selected color. All conversions are done with hand-written functions right in your browser — no external dependencies, nothing uploaded, no sign-up needed.

FormatValueActions
HEX-
RGB-
HSL-

How to Use

  1. Click the color picker to choose a color in your system's color panel, or type a color value directly into the HEX field (both #3a7bd5 and shorthand #fff work).
  2. The picker and the field are linked both ways: change either one and the other side, the values below, and the swatch preview all update together.
  3. Check the HEX, RGB, and HSL values in the result area, and click the “Copy” button on each row to copy that format.
  4. Paste the copied color value straight into your CSS, design files, or code.

Which format suits which scenario: HEX, RGB, or HSL?

HEX (e.g. #3a7bd5) is the most common format in front-end work — compact and easy to copy, perfect for writing straight into CSS; RGB (e.g. rgb(58, 123, 213)) spells out the red, green, and blue channels separately, which is more intuitive when tweaking channels or working with transparency (rgba); HSL (e.g. hsl(210, 50%, 40%)) describes colors with hue, saturation, and lightness, which matches human intuition best — to make a color “a bit brighter” or “a bit more muted,” just adjust lightness and saturation. It's especially handy for building theme color scales and gradients.

All conversions in this tool are done with hand-written pure functions and no third-party libraries: hexToRgb parses 3- and 6-digit HEX, while rgbToHsl and hslToRgb implement the standard color-space conversion formulas. Everything computes locally in an instant — drag the picker and the values follow in real time, what you see is what you get. A handy color tip: start from your brand color's HSL values, then nudge lightness by ±10% to build a harmonious set of light and dark shades.

FAQ

Which HEX formats are supported?
Both the 6-digit standard format (e.g. #3a7bd5) and 3-digit shorthand (e.g. #fff, automatically expanded to #ffffff) are supported. The # can be omitted, and uppercase or lowercase letters are both fine. If your input can't be parsed, you'll see a clear warning — the tool never silently discards your input.
How are the color picker and the text field linked?
They're linked both ways: pick a color in the system picker and the HEX field plus the values below update together; type a valid HEX value in the field and the picker swatch and preview follow along. Both sides always show the same color.
What do the three numbers in HSL mean?
In hsl(210, 50%, 40%): 210 is the hue (an angle on the 0–360 color wheel — around 210 is blue), 50% is saturation (higher means more vivid), and 40% is lightness (0% is pure black, 100% is pure white). Adjusting lightness for depth and saturation for vividness is a standard color-matching technique.
Is there any loss of precision in conversion?
HEX and RGB convert exactly. With HSL, hue is rounded to the nearest degree and saturation and lightness to whole percentages, so round-tripping through RGB can produce single-digit rounding differences (within about 2%) — invisible to the naked eye and perfectly fine for everyday development and design.

Related Tools

📄 SyncPage — real-time document collaboration Review PDFs, slides, Word & Excel files together — present live, annotate in real time, talk by voice. Guests join free from an invite link. Try SyncPage →