Free Online Color Converter (HEX, RGB, HSL)
Convert color codes seamlessly between HEX, RGB, and HSL color spaces. Real-time color swatch preview with one-tap clipboard copying.
How to Convert HEX to RGB and HSL
Pick or type a color.
Open the color picker, type a HEX code such as #3B82F6 or #ABC, or enter numbers in the R, G, B or H, S, L boxes.
Watch the other formats update.
Each change recalculates the other two formats as you type, and the swatch shows the result. A red message means the HEX code is not valid yet.
Copy the value you need.
Press Copy on the HEX, RGB or HSL card. The value goes to your clipboard as CSS, ready to paste into code or a design tool.
Frequently Asked Questions
Answers about HEX, RGB and HSL conversion, short codes, rounding and the formats this tool does not cover.
What is the difference between HEX, RGB and HSL?
They describe the same screen color in three ways. HEX writes red, green and blue as three pairs of base-16 digits, like #FF5733. RGB writes them as numbers from 0 to 255, rgb(255, 87, 51). HSL uses hue, saturation and lightness instead: hsl(11, 100%, 60%).
How do I convert HEX to RGB by hand?
Split the six digits into three pairs and turn each pair from base 16 into a number: the first digit times 16, plus the second. For #FF5733, FF is 255, 57 is 87 and 33 is 51, which gives rgb(255, 87, 51). The tool runs the same math for you.
How do I convert RGB to HEX?
Type the three numbers into the R, G and B boxes and read the HEX card, which updates as you type. For example, 59, 130 and 246 give #3B82F6. Numbers above 255 become 255 and negative numbers become 0, so the code is always valid.
Does it accept 3-digit HEX codes?
Yes. A short code like #ABC is read as #AABBCC, which gives rgb(170, 187, 204). The # sign is optional, and upper or lower case both work. The HEX card keeps the short form you typed, so Copy gives you #ABC.
Can I convert HEX to RGBA or use 8-digit HEX with transparency?
No. The tool has no alpha channel, so it handles solid colors only. The HEX box holds 7 characters, so a pasted 8-digit code like #FF000080 loses its last two digits and its transparency. For rgba(), add the alpha yourself, as in rgba(255, 0, 0, 0.5).
Can I convert HEX to CMYK or Pantone?
Not with this tool. It converts between HEX, RGB and HSL, which all describe screen colors. CMYK and Pantone describe printing inks, so any conversion is a close estimate that depends on the paper and the printer. Ask your print shop for a proof before a large run.
Why does converting HSL back change my HEX code slightly?
HSL is rounded to whole numbers, so it cannot hold every HEX color. #3B82F6 shows as hsl(217, 91%, 60%), which turns back into #3C83F6. Across all 16.7 million colors, about 1 in 10 come back exact and the rest shift by up to 5 per channel. Copy HEX or RGB when the exact value matters.
Why does it say my HEX code is invalid?
The box needs 3 or 6 characters from 0 to 9 and A to F; the # is added for you. The message shows while you are halfway through a 6-digit code and clears once it is complete. Color names like red and 4-digit codes are not read. Leave the box and it returns to the last valid code.
How do I make a color lighter or darker?
Change the L (lightness) box on the HSL card. A higher number moves the color toward white and a lower one toward black, while hue and saturation stay the same. For example, hsl(217, 91%, 60%) at 40% lightness gives #0950C3, a deeper blue.
Can I paste the copied values straight into CSS?
Yes. Copy gives a value CSS reads as it is: #3B82F6, rgb(59, 130, 246) or hsl(217, 91%, 60%). All three work for color, background-color and border-color in every current browser. The RGB and HSL strings use the classic comma style.
Is this color converter free, and is my color sent anywhere?
It is free, with no account and no usage limit. The color math runs in your browser and the colors you enter are never sent. On the live site, Google Analytics logs copy clicks with only the format name, such as hex, plus the time spent on the page.
Can I pick a color from an image?
This tool does not read images. To pull HEX, RGB and HSL codes from a photo or logo, use the color palette extractor, then paste any code into the HEX box here to convert it.
Free Color Converter for HEX, RGB and HSL
Three color formats linked together, the color picker built into your browser and a Copy button on each card. Every value is ready to paste into CSS.

Convert HEX to RGB and HSL
Type a 3- or 6-digit HEX code and the RGB and HSL values update on every keystroke. Edit RGB or HSL instead and the HEX code follows, so all three stay in sync.
- Accepts #RGB and #RRGGBB codes
- The # sign is optional
- Edit any format and the others follow

Color Picker With One-Click Copy
Open the color picker to choose a shade by eye, then press Copy on the HEX, RGB or HSL card. You get a ready CSS value such as rgb(255, 87, 51).
- Uses your browser's own color picker
- A large swatch shows the HEX code
- Copied state shows for 2 seconds
HSL for Easy Shade Changes
Raise L for a lighter tint, lower it for a darker shade, or change H to rotate the hue. RGB and HEX follow each edit.
Values Kept in Range
Type 300 in R and it becomes 255, and a negative number becomes 0. Hue stops at 360 and saturation and lightness at 100, so every result is a valid color.
CSS-Ready Color Values
Copies come out as #FF5733, rgb(255, 87, 51) or hsl(11, 100%, 60%). Paste them into a stylesheet, a Tailwind theme or a design token file as they are.
Free, Private and No Sign-Up
No account and no usage limit. The colors you enter stay in your browser. On the live site, Google Analytics counts copy clicks by format and time spent on the tool, never the color.
Who Uses a Color Converter?
Anyone who moves colors between code, design files and style guides.
Web Developers
Turn a HEX code from a design file or the browser inspector into rgb() or hsl() for a stylesheet, then copy it straight into your CSS.
- Turn a HEX code into hsl() for CSS variables
- Check the RGB numbers behind a HEX code
- Paste a copied value into a Tailwind theme color
Designers
Find the HEX code of a shade you picked by eye, or nudge lightness and saturation in HSL to build lighter and darker versions of one color.
- Make a tint by raising HSL lightness
- Get the HEX code of a shade you picked
- Turn RGB values from a design app into HEX
Brand & Style Guide Teams
List each brand color as HEX, RGB and HSL side by side, so developers and designers read the same value in the format they use.
- Write HEX, RGB and HSL for each brand color
- Turn old RGB codes from a style guide into HEX
- Expand short HEX codes like #ABC into RGB
Explore More Tools
Discover other free tools that work great alongside this one
Contrast Checker
Check color contrast ratios for WCAG compliance
CSS Gradient Generator
Build custom CSS gradients visually
Color Palette Extractor
Pull the main colors from an image as HEX, RGB or HSL
Box Shadow Generator
Design CSS box-shadows with live preview
QR Code Generator
Make free QR codes in your colors
Image Converter
Convert between 30+ image formats