inyourbrowser.com

Color Converter

Color converter is a color tool that translates a color between HEX, RGB and HSL. It accepts 3 or 6 digit hex codes or RGB and HSL numbers, shows all three formats at once next to a live swatch, and copies any value with one click. The tool runs in your browser.

Input
#
All formats
HEX#3b82f6
RGBrgb(59, 130, 246)
HSLhsl(217, 91%, 60%)

CONVERT

All three formats are shown simultaneously regardless of mode.

Runs entirely in your browser

How to convert colour formats

  1. Pick a conversion in the Convert panel, for example HEX → RGB.
  2. Enter a 3 or 6 digit HEX code, or type the R, G and B values (0 to 255) or the H (0 to 360), S and L (0 to 100) values.
  3. Read the HEX, RGB and HSL results, which update as you type, and check the color in the swatch.
  4. Click Copy next to the format you need.

Common uses

  • Converting HEX colours from a design file to RGB or HSL for CSS, then verify the color pair passes WCAG contrast requirements
  • Finding the HSL value of a colour to adjust lightness or saturation in code, then explore tints and shades built from that base
  • Translating colours between formats when moving assets between design tools, alongside a color palette generator to build a cohesive scheme

Technical specification

  • Algorithm or formula: Pure JavaScript color math: HEX ↔ RGB via base-16 parsing, RGB ↔ HSL using the standard hue-from-max/min formula.
  • Browser API or library: Native parseInt and arithmetic. No external library.
  • Input limits: HEX with 3 or 6 digits (the # is optional), RGB as three numbers from 0 to 255, and HSL as hue 0 to 360 with saturation and lightness 0 to 100, each in its own field. No alpha channel, and no rgb() or hsl() string parsing.
  • Output: HEX, RGB and HSL displayed at once, each with a copy button. HSL is rounded to whole numbers, so converting it back to RGB can shift a channel slightly (by up to 5 out of 255). Empty or out-of-range input shows no result instead of being clamped.
  • Known limitations: No HSV/HSB and no alpha channel. No wide-gamut color spaces (Display P3, Lab, LCH, OKLCH). Named CSS colors are not auto-resolved.

Frequently asked questions

What colour formats does the tool support?
The tool converts between HEX (3 or 6 digits, e.g. #3b82f6), RGB (0 to 255 per channel, e.g. rgb(59, 130, 246)) and HSL (hue, saturation and lightness, shown as whole numbers).
Is my data sent to a server?
All conversion is pure JavaScript running in your browser.
Can I enter colours with transparency (alpha)?
The tool works with opaque colours only. HEX input takes 3 or 6 digits, and there are no RGBA, HSLA or HEX8 fields.
How do I get the CSS value for a colour?
Copy any of the three. #3b82f6, rgb(59, 130, 246) and hsl(217, 91%, 60%) are all valid CSS. HSL is handy in code because hue, saturation and lightness are separate numbers you can change one at a time.

Related tools

Contrast checker
Check WCAG AA/AAA contrast ratios between two colours. Live pass/fail results.
Color palette generator
Generate complementary, analogous, triadic, and monochromatic color palettes. Copy hex values or all colors as CSS variables.
Tints & shades generator
Generate 5, 10, or 20 tints and as many shades from any base color. Click any swatch to copy the hex code.
Image color picker
Pick any color from an image you open. Hex, RGB, and HSL output. Runs in your browser.
Number base converter
Convert numbers between binary, octal, decimal, and hex. All bases shown at once.

Reviewed and tested September 30, 2026.