How do I convert colors between HEX, RGB, and HSL?
Enter a color in any format — HEX (#ff6600), RGB (rgb(255, 102, 0)), or HSL (hsl(24, 100%, 50%)) — and instantly see it converted to all other formats. The tool includes a live color preview and lets you copy any value with one click.
#3B82F6
rgb(59, 130, 246)
Tips & Best Practices
HSL is the most intuitive model for UI design
HSL separates hue (the color), saturation (intensity), and lightness (brightness). To create a darker button hover state, reduce lightness by 10%. To create a muted variant, reduce saturation. In HEX/RGB you'd need to adjust all three channels — HSL makes systematic color palettes trivial.
HEX shorthand can cause subtle color differences
#333 expands to #333333, but #123 expands to #112233 — not #010203. Each digit is doubled, not treated as the first digit of a two-digit pair. This catches designers who assume #1A2 means a color close to #1A2000 when it actually becomes #11AA22.
CSS oklch() is the future of web color
The oklch() color function (supported in all modern browsers since 2023) provides perceptually uniform colors. Unlike HSL where lightness: 50% produces visually different brightness for different hues, oklch guarantees consistent perceived brightness. This is why a yellow and blue at the same HSL lightness look completely different.
Use 8-digit HEX for alpha transparency
Instead of rgba(255, 0, 0, 0.5), use #FF000080. The last two hex digits represent alpha (00 = transparent, FF = opaque). 80 in hex is 128 in decimal, or 50% opacity. This is supported in all modern browsers and keeps your CSS consistent with the HEX format.
Frequently Asked Questions
How do I convert a HEX color to RGB?
What is the difference between HEX, RGB, and HSL color formats?
Can I convert colors with transparency (alpha channel)?
Related Convert Tools
SVG to JSX Converter
Convert SVG to JSX or a React/TypeScript component — camelCase attributes, style objects, forwardRef, memo, props spread
OpenAPI to TypeScript
Convert OpenAPI 3.x and Swagger 2.0 specs to TypeScript interfaces and types with $ref resolution, allOf/oneOf/anyOf, enums, and API operation types
JSON to Zod Converter
Convert JSON or JSON Schema to Zod validation schemas with $ref resolution, allOf/oneOf/anyOf, enum, format constraints, and required/optional fields
GraphQL to TypeScript
Convert GraphQL SDL schemas to TypeScript interfaces, types, enums, unions, and operations