🔒 Processed locally in your browser — no data uploaded
← Back to Home

Color Converter

HEX colour value
Conversion result

What the Color Converter does

This page converts a single colour between the three formats a stylesheet or design tool usually speaks: HEX, RGB and HSL. You pick which format you are typing in, enter one value, and the other two appear at once alongside a live square preview of the colour. There is no convert button, because every keystroke that parses correctly redraws the result immediately.

Enter #ff6600 in HEX mode and it comes back as RGB 255, 102, 0 and HSL 24, 100%, 50%, with an orange swatch beside the input. Designers use it to move a brand colour between a design file and a stylesheet, to find out what hue and lightness a shade is really built from, or to grab an arbitrary colour for a placeholder block.

How to use it

  1. Pick the input formatClick the HEX, RGB or HSL button at the top. The label above the text box changes with it, telling you the shape the value needs to take.
  2. Type the colour valueEnter a hash colour, three comma-separated channel numbers, or a hue with saturation and lightness percentages, depending on which input button is active at the top of the page.
  3. Check the preview squareThe small box beside the input fills with the parsed colour straight away. If it goes blank, the text was not in a shape the parser recognises.
  4. Read the format you needAll three lines are rewritten on every change, so copy the HEX, RGB or HSL line depending on what the target file or tool expects.

Options and formats

HEX inputAccepts three or six hexadecimal digits with or without a leading hash, in upper or lower case. Three-digit shorthand is expanded by doubling each digit, so #f60 becomes #ff6600.
RGB inputWants three whole numbers separated by commas, such as 255, 102, 0. Spaces after the commas are fine; decimals and percent signs are not, and out-of-range numbers are not trimmed.
HSL inputWants a whole degree for hue, then saturation and lightness each followed by a percent sign, as in 24, 100%, 50%. Hue wraps around the circle, so 360 and 0 describe the same red.
Live swatchThe preview is drawn from the parsed value rather than from your text, so it is a genuine check that what you typed produced the colour you had in mind.
Random colourEach of the red, green and blue channels is drawn independently across the full range, which spreads results evenly through the colour cube rather than producing tasteful palettes.

Things to watch out for

No transparency supportThere is nowhere to put an alpha value. Eight-digit hex such as #ff660080 and CSS rgba() notation are both rejected, so any opacity has to be applied later in your own stylesheet.
Channel values above 255Nothing stops you typing 300 for a channel. The result is a malformed hex string and nonsensical hue and saturation figures, because the number is formatted rather than clamped to its legal maximum.
One bad character clears itA single stray letter or symbol makes the parse fail, and the page responds by emptying the output and dropping the preview instead of keeping the last valid colour on screen.
Commas are required in RGBSpace-separated or function-wrapped values such as rgb(255 102 0) do not parse. Only the bare comma-separated triple is accepted, so brackets and the function name must be stripped first.

Frequently asked questions

Do I need to include the hash in HEX mode?

No, six or three hex digits on their own are read as a colour and the hash is added for you. Letters can be upper or lower case, so FF6600 and ff6600 produce the same result, and a leading hash is equally acceptable if you are pasting from a stylesheet.

Why did my colour shift slightly after converting?

Hue is stored as whole degrees and saturation and lightness as whole percents in both directions. A colour that does not sit exactly on those values loses a fraction each time it passes through HSL, which is invisible on screen but can show up if you are comparing hex codes.

Can I type a colour name like tomato?

No, only numeric values are parsed: hex digits, an RGB triple, or an HSL triple. Words, CSS custom properties and function notation such as rgb() or hsl() are all treated as invalid, and the preview clears until the text is in a recognised shape.

How does the random button choose colours?

It draws red, green and blue independently, so every colour in the cube is equally likely. That means a lot of muddy mid-tones and very few colours that work together, which is fine for a placeholder fill but useless for building a palette.

What is the preview square actually showing?

It shows the colour the parser built from your input, not an approximation of your text. When a value converts into something other than what you expected, the swatch is the clearest evidence, and a blank square means nothing was parsed at all.

Can I convert a whole palette at once?

No, the page holds one colour at a time and each conversion replaces the last. Working through a palette means entering values one by one and noting the output, so a batch job really needs a script rather than this page.