HEX ↔ RGB Color Converter
Convert HEX colour codes to RGB and HSL values instantly
About Colour Conversion
All conversions use pure JavaScript math — no libraries, no server requests.
How to Use This Tool
- Enter a color value in any of the three formats: HEX (#rrggbb), RGB (rgb(r, g, b)), or HSL (hsl(h, s%, l%)).
- The other two representations update instantly as you type.
- The color preview swatch shows the resulting color in real time.
- Click "Copy" next to any format to copy that value directly to your clipboard.
Common Use Cases
- Converting a brand color from HEX (as delivered by a designer) to RGB for use in CSS or a design tool.
- Finding the HSL representation of a color to make programmatic lightness or saturation adjustments.
- Checking that a color specified in an old stylesheet in RGB matches the HEX used in a newer design system.
- Exploring color relationships by adjusting hue, saturation, and lightness while watching the HEX update.
- Converting colors from a Figma or Sketch file (HEX) to values needed by a native mobile app (RGB 0–1 floats).
Frequently Asked Questions
What is the difference between HEX, RGB, and HSL?
HEX is a compact hexadecimal notation (e.g. #3b82f6). RGB specifies the red, green, and blue channel intensities from 0–255. HSL stands for Hue (0–360° on the color wheel), Saturation (0–100%), and Lightness (0–100%).
Why is HSL more intuitive for design?
HSL separates color identity (hue) from vividness (saturation) and brightness (lightness). This makes it easy to create tints (high lightness) and shades (low lightness) of the same color without guessing the RGB values.
Does this converter support alpha (transparency)?
The current version handles fully opaque colors. Alpha channel support (RGBA, HSLA, and 8-digit HEX) is planned for a future update.
Are there rounding differences between formats?
Yes. Converting between formats involves floating-point arithmetic, so there can be small rounding differences of ±1 in RGB values. These differences are imperceptible to the human eye and are not a concern for practical use.