Skip to content
Developer

Color Converter

Convert colors between HEX, RGB, HSL with a live preview.

colorhexrgbhslconvert
Loading tool…

Recommended tools

Affiliate links — we may earn a commission if you sign up.

About the Color Converter

The Color Converter translates a single color across HEX, RGB, and HSL while showing exactly what you will get: a color picker and a hex field sit at the top, an RGB text field accepts rgb(r, g, b) notation, and every valid change instantly updates a live preview swatch plus copyable conversion rows for all three formats. The hex input is forgiving — both #RGB shorthand and #RRGGBB are accepted, with the shorthand expanded automatically — and invalid values trigger a toast explaining the expected format. RGB values are clamped to the 0–255 byte range, so entering rgb(300, 0, 0) normalizes to 255 instead of producing nonsense. Output rows for HEX, RGB, and HSL each carry their own Copy button, and an R/G/B breakdown grid shows the exact channel values of the current color. The tool loads with #0EA5E9, a sky blue, so the conversions are visible before you type a single character. It is the quickest way to grab an HSL variant of a hex value from a design file, or to translate a Tailwind palette color into CSS for a style sheet.

Hand-written guide

Examples

Input
#0EA5E9
Output
HEX: #0EA5E9 · RGB: rgb(14, 165, 233) · HSL: hsl(199, 89%, 48%)
Note: The default sky-blue hex produces all three formats in the copyable rows, with the live swatch showing the color itself.
Input
#fff
Output
HEX: #FFFFFF · RGB: rgb(255, 255, 255) · HSL: hsl(0, 0%, 100%)
Note: Three-digit shorthand is expanded automatically, so #fff converts as #FFFFFF without manual doubling.
Input
rgb(220, 38, 38)
Output
HEX: #DC2626 · RGB: rgb(220, 38, 38) · HSL: hsl(0, 72%, 51%)
Note: Typing rgb(r, g, b) into the RGB field syncs the hex input, preview, and HSL row instantly; channels are clamped to 0–255.

How to use

  1. 1

    Pick a color with the Color picker input or type hex into the Hex field (e.g. #0EA5E9).

  2. 2

    Watch the live preview swatch and the three conversion rows update immediately.

  3. 3

    Type rgb(r, g, b) into the Or enter RGB field to convert from RGB instead.

  4. 4

    Click the Copy button on any row — HEX, RGB, or HSL — to grab that format.

  5. 5

    Check the R/G/B grid for the exact channel values of the current color.

Common use cases

  • Translating a hex value from a design file into rgb() for legacy CSS.
  • Getting the HSL representation of a Tailwind palette color for custom theming.
  • Copying an exact brand color into a charting library that expects rgb() strings.
  • Deriving a color from a screenshot by picking and then copying all three formats.
  • Debugging rendered colors by comparing the numeric channels against a style guide.
  • Choosing accessible colors by reading the HSL saturation and lightness values.

Best practices

  • Trust the preview swatch, not memory — the same hex can look very different on different displays.
  • Copy the format your target API expects; mixing rgb() into HSL-only libraries is a common bug.
  • Use the shorthand #RGB form only for quick tests; expand it before committing to CSS for consistency.
  • When colors look off in production, compare the R/G/B grid values here against the devtools computed style.
  • For opacity work, remember this tool outputs opaque rgb() — use rgba() or a hex-with-alpha value elsewhere.
  • Keep the hex input normalized with a leading # so the parser never reports an invalid hex toast.

Tips

  • Use the native picker for exploration, then copy the HEX row — it is always normalized.
  • Type 3-digit hex in the input to see the 6-digit expansion in the HEX row immediately.
  • The RGB field is a two-way control: it also serves as a live preview of what you converted.
  • For a quick lightness check of any color, read the last number of the HSL row.

Frequently asked questions

The tool accepts #RGB (three-digit shorthand) and #RRGGBB with or without a leading #, case-insensitively. Shorthand is expanded by doubling each digit, so #0af becomes #00AAFF. Anything else triggers an Invalid hex color toast explaining the expected formats.

Explore more developer tools

Browse the full collection of developer tools on the hub, or jump back to all categories.

Related tools