HTML Color Code Converter

Paste a hex, rgb, hsl, or named color and read the other forms. The swatch is the parsed color. Modern wide-gamut syntax is out of scope.

Last updated: October 5, 2026

Tool

This tool will load here.

What this tool does

This color code converter takes one color string and writes the other forms this page supports. It parses the text itself. It does not ask the browser whether a leftover color from the previous try still counts as success. An invalid string is an error, and the previous table and swatch are cleared.

Supported syntax is a closed set. Hex may be #rgb, #rgba, #rrggbb, or #rrggbbaa. rgb() and rgba() use commas. Channels are integers or decimals from 0 to 255, or percentages from 0% to 100%. hsl() and hsla() use commas. Hue is a number of degrees, with an optional deg unit. Saturation and lightness are percentages. Alpha is a number from 0 to 1, or a percentage. Named colors are the fixed CSS names shipped in the page, including the grey and gray spellings, plus transparent.

The swatch is painted from the numbers the parser produced, never from the raw paste. A six-digit hex is used when alpha is 1. Otherwise the swatch is an rgba() built from those numbers. Output rows are HEX, RGB or RGBA, HSL or HSLA, and alpha. When alpha is not 1, HEX is eight digits.

HSL in the result is not a copy of the hue you typed. The page turns the color into integer red, green, and blue, then rounds hue, saturation, and lightness from those channels. That is the same rounding as the Color Generator. The guide HEX, RGB, and HSL: How Color Values Relate already explains why a rounded HSL can sit a step away from a hand-tuned HSL. The generator still has no field for a color you paste. This page is that missing conversion. It does not draw a random color.

How to use

  1. Paste one color. Case does not matter.
  2. Choose Convert, or press Enter in the field.
  3. Read the four rows and the swatch. Copy writes the rows. Clear empties the field, the table, and the swatch.

Empty input is an error. The limit is 200 characters. Space-separated rgb and slash alpha are rejected with a message to use commas. turn, rad, and grad are not accepted as hue units.

Example

#fc0 is #ffcc00, rgb(255, 204, 0), and the HSL rounded from those integers, with alpha 1. #f008 expands to red with the alpha nibble repeated, so the HEX row is eight digits and the RGB row is rgba. rgb(100%, 0%, 0%) is #ff0000. hsl(0, 100%, 50%) is the same red after the integer round trip. rebeccapurple is the named color #663399. oklch(0.6 0.1 30) and color-mix(in srgb, red, blue) are errors, and a swatch from a previous success does not stay up.

#fc0

A percentage channel uses round(percent × 255 / 100). 50% is 128, not a fraction left in the RGB row. Alpha that is exactly 0 or 1 is shown as 0 or 1. Other alphas are shown to four decimal places, while an eight-digit hex keeps the nearest byte.

Limits

  • Hex, comma-form rgb and hsl, and the named table. Nothing else.
  • No oklch, lab, lch, color(), color-mix(), or relative color syntax.
  • HSL output is rounded from integer channels.
  • 200 characters. The swatch is the parsed color only.

Wide-gamut spaces and color mixing are a different job. This page will not pretend a string it does not parse is “close enough” to sRGB. Invalid input clears the previous result so a failed try cannot be copied as if it had worked.

The converter does not generate a color, sample a pixel, or build a gradient. Those pages stay separate. Clear removes the paste and the swatch from the page. Nothing is stored.

On this page

Related Articles

Related guides

Related solutions

Need another tool ?

Open the free tools — no signup.

FAQs

newsletter signup

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Innovative Solutions For Modern Needs
Copyright © 2026 Yallasolve. all rights reserved.