Design · verktøy

Fargekonverterer

Skriv inn en HEX-, RGB- eller HSL-farge og få de andre formatene umiddelbart.

Kjøres i nettleseren. Ingen opplasting.

Supports HEX, RGB and HSL colors.

HEX
—
RGB
—
HSL
—

Om verktøyet

Fargekonverterer sem complicação.

Nyttig for CSS, fargepaletter og raske designsjekker. Konvertering og forhåndsvisning skjer helt i nettleseren.

Veiledning

Slik bruker du Fargekonverterer

The Color Converter takes one colour written as HEX, RGB or HSL and shows it in all three forms next to a small swatch. It is meant for CSS work and quick design checks. It reads three-digit and six-digit HEX codes, rgb() with values from 0 to 255, and hsl() with percentages. It does not handle transparency, colour names, or print colour spaces such as CMYK.

Slik gjør du

  1. Type or paste a colour into the box, such as #4D6BFF, 4d6bff, rgb(77, 107, 255) or hsl(230, 100%, 65%). The box starts with #4D6BFF already in it.
  2. Press Convert color. The HEX, RGB and HSL lines fill in and the swatch shows the colour.
  3. Select the line you need and copy it by hand into your stylesheet or design file.
  4. If the three lines show a dash, the text was not understood. Read the message under the box and fix the format.

Eksempler

A six-digit HEX code

Du skriver inn
Farge
#4D6BFF
Du får
HEX
#4D6BFF
RGB
rgb(77, 107, 255)
HSL
hsl(230, 100%, 65%)

Each pair of HEX digits is one channel: 4D is 77, 6B is 107 and FF is 255. The HSL form is worked out from those three numbers and rounded to whole numbers.

Kjørt med verktøyets egen kode.

An HSL colour

Du skriver inn
Farge
hsl(120, 50%, 50%)
Du får
HEX
#40BF40
RGB
rgb(64, 191, 64)
HSL
hsl(120, 50%, 50%)

A hue of 120 is green, and 50% saturation and lightness give a soft mid green. The red and blue channels come out at 64 and the green channel at 191.

Kjørt med verktøyets egen kode.

Converting back loses a little

Du skriver inn
Første
#123456
Andre
hsl(210, 65%, 20%)
Du får
Første gir HSL
hsl(210, 65%, 20%)
Andre gir HEX
#123354

The HEX code #123456 is shown as hsl(210, 65%, 20%), with each number rounded to a whole number. Typing that HSL value back gives #123354, a slightly different colour, because the rounding threw away a little detail.

Kjørt med verktøyets egen kode.

Når det er nyttig

  • Turn a brand HEX code from a style guide into the rgb() or hsl() form that your CSS uses.
  • Read an hsl() value from a stylesheet as HEX so you can paste it into a design program.
  • Find the HSL numbers for a colour before you make it lighter or darker by hand.
  • Check a short three-digit HEX code by seeing the full six-digit colour it stands for.

Begrensninger

  • Accepted inputs are HEX with 3 or 6 digits, rgb(r, g, b) with commas and values from 0 to 255, and hsl(h, s%, l%) with commas. Colour names, percentages inside rgb(), and space-separated syntax such as rgb(77 107 255) are refused.
  • There is no alpha channel. An 8-digit code like #4D6BFF80 or rgba(77, 107, 255, 0.5) gives an error, even though CSS allows both.
  • HSL results are rounded to whole numbers, and decimals in rgb() are rounded to the nearest whole number, so a round trip can end one step away from where it began.
  • The tool does plain sRGB-style arithmetic for web colours. It does no colour management, no CMYK and no wide-gamut spaces.

Tips

  • Keep the original HEX or RGB value as your master copy and treat the rounded HSL as a handy working view.
  • Use the HSL lightness number to make a darker or lighter shade, then convert the new value back to HEX.
  • A colour that looks good as a swatch can still be hard to read as text, so check text contrast with a separate contrast checker.

Kilder

Vanlige spørsmål

Sobre Fargekonverterer.

How do I convert HEX to RGB?

Type the HEX code and press Convert color. Each pair of digits is one channel in base 16, so #4D6BFF becomes rgb(77, 107, 255). The tool does the arithmetic and shows the RGB and HSL forms together.

Do I need to type the # sign?

No. The hash is optional, and capital or small letters both work. The tool writes the HEX result in capitals with a hash, so 4d6bff and #4D6BFF give the same lines.

Does it accept short codes like #f80?

Yes. A three-digit code repeats each digit, as the CSS colour standard describes, so #f80 is read as #FF8800 and shows as rgb(255, 136, 0). Codes with 4 or 8 digits, which carry transparency, are not accepted.

Why does my colour change a little when I convert back?

HSL is shown with whole numbers for hue, saturation and lightness. Rounding removes small differences, so turning that HSL back into HEX can land on a neighbouring colour. Keep the first HEX or RGB value as the exact one.

Why do I get an error for rgba or a colour name?

The tool reads only opaque colours in the three listed forms. A colour name such as red, or any value with an alpha number, is refused. Replace the name with its code, such as #FF0000.

Is my colour sent anywhere?

No. The page says the conversion and the preview happen entirely in your browser, so the colour you type is not uploaded.

Hvordan bruker du Fargekonverterer?

Skriv inn en HEX-, RGB- eller HSL-farge og få de andre formatene umiddelbart.

Lastes dataene mine opp til en server?

Nei. Behandlingen skjer i nettleseren din, og opplysningene dine lastes ikke opp.