Color Converter
Convert between HEX, RGB, and HSL color codes with live preview.
๐ How to Use
Use the color picker or enter a HEX code directly (e.g. #4f46e5).
RGB and HSL values are automatically calculated and displayed.
Click on any field to copy its value. Click ๐ฒ Random Color to generate a random color.
About the Color Converter
A color on the web is ultimately a mix of red, green, and blue light on an emissive screen — an additive RGB model where full intensity of all three channels yields white. CSS exposes three interchangeable notations for this sRGB color space: HEX, RGB, and HSL. This converter lets you type or pick any color and see its representation in all three, so a value from a design tool can be pasted straight into a stylesheet.
How it works
HEX writes each of the three channels as two hexadecimal digits: #RRGGBB, each pair ranging from 00 (0) to FF (255). CSS Color 4 also allows an 8-digit form, #RRGGBBAA, whose last pair encodes alpha — FF opaque, 00 transparent. RGB spells the channels as decimal triplets, rgb(r, g, b), again 0–255. HSL takes a different angle: hsl(h, s%, l%) uses hue as an angle from 0–360° around the color wheel (0 red, 120 green, 240 blue), with saturation and lightness as percentages.
Conversions are pure arithmetic. To go HEX→RGB, split the string into three pairs and read each as a base-16 number. To go RGB→HSL, normalize each channel to 0–1, derive lightness from the max and min, then saturation from the spread, and finally the hue from which channel peaks. Two caveats: monitors vary, so identical numbers render slightly differently across hardware (gamma and color management apply); and if you use the alpha channel, keep the background in mind — alpha blends against whatever sits behind the element.
Common use cases
- Translating a designer's HEX token into
hsl()to derive hover and disabled states - Reading an
rgb()value from devtools and pasting it into a CSS variable - Picking a brand accent and grabbing the 8-digit
#RRGGBBAAform for a translucent overlay - Tuning HSL lightness for predictable, accessible contrast ratios
Worked example
Take the indigo #4f46e5. Split into pairs 4f, 46, e5 and convert each from base 16:
4f=79 46=70 e5=229
#4f46e5 = rgb(79,70,229)
Applying the HSL formulas gives:
#4f46e5 = hsl(244,76%,59%)
The same color, three notations — identical pixel, different ergonomics.
Frequently asked questions
What is the difference between HEX, RGB, and HSL?
HEX packs each channel into two hex digits (#RRGGBB). RGB lists the same three channels as decimal values from 0 to 255. HSL describes a color with hue (0–360 degrees on the color wheel), saturation, and lightness as percentages. All three describe the same sRGB color, just in different coordinate systems.
What does the 8-digit HEX code include?
An 8-digit HEX such as #RRGGBBAA adds an alpha channel as the final two hex digits, where FF is fully opaque and 00 is fully transparent. It is supported in CSS Color 4 and lets you encode opacity without a separate opacity property.
How do I convert HEX to RGB?
Split the 6-digit HEX into three pairs and read each pair as a base-16 number. For #4f46e5 the pairs are 4f, 46, and e5, which equal 79, 70, and 229, giving rgb(79, 70, 229).
Is HSL better than RGB for adjusting colors?
Yes, for human adjustments. HSL separates the perceived hue from saturation and lightness, so you can darken or desaturate a color predictably. RGB forces you to balance three correlated channels, which is harder to reason about.
Are the converted colors sent to a server?
No. All conversions run in your browser through plain JavaScript arithmetic on the channel values. Nothing is uploaded, so the tool is safe to use with brand palettes and proprietary design tokens.
์์ ๋ณํ๊ธฐ๋?
์น์์ ํ๋์ ์์ ๊ฒฐ๊ตญ ๋น์ ๋ด๋ ํ๋ฉด์์ ๋นจ๊ฐยท์ด๋กยทํ๋ ๋น์ ์์ด ๋ง๋ ๊ฒฐ๊ณผ์ ๋๋ค — ์ธ ์ฑ๋ ๋ชจ๋ ์ต๋ ๊ฐ๋์ผ ๋ ํฐ์์ด ๋๋ ๊ฐ์ฐ ํผํฉ(additive) RGB ๋ชจ๋ธ์ ๋๋ค. ๋์์ด๋๊ฐ ์ด ๋ ๊ฒ์ ์ซ์๋ฅผ ๋งค๋ฒ ๋ค๋ฃจ๊ธด ์ด๋ ต๊ธฐ ๋๋ฌธ์, CSS๋ ๋์ผํ sRGB ์์์ญ์ ์ธ ๊ฐ์ง ์ํธ ๊ตํ ๊ฐ๋ฅํ ํ๊ธฐ๋ฒ์ผ๋ก ๋ ธ์ถํฉ๋๋ค. ๋ฐ๋ก HEX, RGB, HSL์ ๋๋ค. ์ด ๋ณํ๊ธฐ๋ ์์ ๊ณ ๋ฅด๊ฑฐ๋ ์ ๋ ฅํ๋ฉด ์ธ ํ๊ธฐ๋ฒ ๋ชจ๋๋ก ์ฆ์ ๋ณด์ฌ ์ฃผ์ด, Figma ์ธ์คํํฐ์์ ์ฝ์ ๊ฐ์ ์คํ์ผ์ํธ์ ๊ทธ๋๋ก ๋ถ์ฌ๋ฃ๊ฑฐ๋ ๊ทธ ๋ฐ๋ ์์ ์ ํ ์ ์๊ฒ ํด ์ค๋๋ค.
์๋ ๋ฐฉ์
HEX๋ ์ธ ์ฑ๋ ๊ฐ๊ฐ์ 16์ง์ ๋ ์๋ฆฌ๋ก ํ๊ธฐํฉ๋๋ค. #RRGGBB์์ ๊ฐ ์์ 00(0)๋ถํฐ FF(255)๊น์ง์
๋๋ค. CSS Color 4๋ 8์๋ฆฌ ํํ์ธ #RRGGBBAA๋ ํ์ฉํ๋ฉฐ, ๋ง์ง๋ง ์์ด ์ํ(๋ถํฌ๋ช
๋)๋ฅผ ๊ฐ์ ๋ฐฉ์์ผ๋ก ์ธ์ฝ๋ฉํฉ๋๋ค — FF๋ ์์ ํ ๋ถํฌ๋ช
, 00์ ์์ ํ ํฌ๋ช
์
๋๋ค. RGB๋ ์ฑ๋์ ์ญ์ง์ ์ธ ์์ผ๋ก ํ์ด ์๋๋ค. rgb(r, g, b)์์๋ ๊ฐ ๊ฐ์ 0–255 ๋ฒ์์
๋๋ค. HSL์ ๋ค๋ฅธ ์ ๊ทผ์ ์๋๋ค. hsl(h, s%, l%)์ ์์(hue)์ ์์ํ์ ๋๋ ๊ฐ๋(0–360°, 0์ ๋นจ๊ฐ, 120์ ์ด๋ก, 240์ ํ๋)๋ก, ์ฑ๋(saturation)์ ๋ช
๋(lightness)๋ ๋ฐฑ๋ถ์จ๋ก ํํํฉ๋๋ค.
๋ณํ์ ์์ ์ฐ์ ์
๋๋ค. HEX→RGB๋ก ๊ฐ๋ ค๋ฉด ๋ฌธ์์ด์ ์ธ ์์ผ๋ก ๋๋ ๊ฐ๊ฐ์ 16์ง์๋ก ์ฝ์ต๋๋ค. RGB→HSL๋ก ๊ฐ๋ ค๋ฉด ๊ฐ ์ฑ๋์ 0–1๋ก ์ ๊ทํํ ๋ค ์ต๋๊ฐ๊ณผ ์ต์๊ฐ์ผ๋ก ๋ช
๋๋ฅผ ๊ตฌํ๊ณ , ๊ทธ ์ฐจ์ด๋ก ์ฑ๋๋ฅผ ๋์ถํ ๋ค์ ์ด๋ ์ฑ๋์ด ์ ์ ์ธ์ง๋ก ์์(hue)์ ๊ตฌํฉ๋๋ค. ๋ ๊ฐ์ง ์ค๋ฌด์ ์ฃผ์์ ์ด ์์ต๋๋ค. ๋ชจ๋ํฐ๋ง๋ค ๋ฌ๋ผ์ ๊ฐ์ ์ซ์๋ผ๋ ํ๋์จ์ด์ ๋ฐ๋ผ ์ฝ๊ฐ์ฉ ๋ค๋ฅด๊ฒ ๋ ๋๋ง๋ฉ๋๋ค(๊ฐ๋ง์ ์ ๊ด๋ฆฌ๊ฐ ์ ์ฉ๋จ). ๊ทธ๋ฆฌ๊ณ ์ํ ์ฑ๋์ ํจ๊ป ์ธ ๋๋ ์์ ๋ค์ ๋์ธ ๊ฒ๊น์ง ํจ๊ป ๊ณ ๋ คํด์ผ ํฉ๋๋ค — ์ํ๋ ๋ฐฐ๊ฒฝ๊ณผ ํผํฉ๋๊ธฐ ๋๋ฌธ์
๋๋ค.
์์ฃผ ์ฐ๋ ๊ฒฝ์ฐ
- ๋์์ด๋์ HEX ํ ํฐ์
hsl()๋ก ์ฎ๊ฒจ hoverยท๋นํ์ฑ ์ํ๋ฅผ ๋์ถํ๊ธฐ - DevTools์์
rgb()๊ฐ์ ์ฝ์ด Sass๋ CSS ๋ณ์์ ๋ถ์ฌ๋ฃ๊ธฐ - ๋ธ๋๋ ๊ฐ์กฐ์์ ๊ณ ๋ฅด๊ณ ๋ฐํฌ๋ช
์ค๋ฒ๋ ์ด์ฉ 8์๋ฆฌ
#RRGGBBAAํํ ๊ฐ์ ธ์ค๊ธฐ - HSL ๋ช ๋๋ฅผ ์กฐ์ ํด ์์ธก ๊ฐ๋ฅํ ๋ช ์๋น๋ก ์ ๊ทผ์ฑ ํ๋ ํธ ๋ง๋ค๊ธฐ
์ฌ์ฉ ์
์ธ๋๊ณ ์ #4f46e5๋ฅผ ์๋ก ๋ค๋ฉด, 4f, 46, e5 ์์ผ๋ก ๋๋ ๊ฐ๊ฐ์ 16์ง์์์ ๋ณํํฉ๋๋ค:
0x4f = 79
0x46 = 70
0xe5 = 229
#4f46e5 = rgb(79, 70, 229)
์ด ์ฑ๋๋ค์ ์ ๊ทํํ๊ณ HSL ๊ณต์์ ์ ์ฉํ๋ฉด:
#4f46e5 = hsl(244, 76%, 59%)
๊ฐ์ ์, ์ธ ๊ฐ์ง ํ๊ธฐ๋ฒ — ํ๋ฉด ํฝ์ ์ ๋์ผํ์ง๋ง ์ฝ๋๋ฅผ ์ฝ๋ ์ฌ๋์๊ฒ๋ ๋ค๋ฅธ ์ฌ์ฉ์ฑ์ ์ค๋๋ค.
์์ฃผ ๋ฌป๋ ์ง๋ฌธ
HEX, RGB, HSL์ ์ฐจ์ด๋?
HEX๋ ๊ฐ ์ฑ๋์ 16์ง์ ๋ ์๋ฆฌ๋ก ์์ถํฉ๋๋ค(#RRGGBB). RGB๋ ๊ฐ์ ์ธ ์ฑ๋์ 0~255์ ์ญ์ง์๋ก ๋์ดํฉ๋๋ค. HSL์ ์์ ์์ํ ์์ ๊ฐ๋์ธ ์์(hue, 0~360๋)๊ณผ ์ฑ๋, ๋ช
๋(๋ฐฑ๋ถ์จ)๋ก ํํํฉ๋๋ค. ์
๋ชจ๋ ๋์ผํ sRGB ์์ ๋จ์ง ๋ค๋ฅธ ์ขํ๊ณ๋ก ์์ ํ ๋ฟ์
๋๋ค.
8์๋ฆฌ HEX ์ฝ๋๋ ๋ฌด์์ ํฌํจํ๋์?
#RRGGBBAA ๊ฐ์ 8์๋ฆฌ HEX๋ ๋ง์ง๋ง 16์ง์ ๋ ์๋ฆฌ์ ์ํ ์ฑ๋์ ์ถ๊ฐํฉ๋๋ค. FF๋ ์์ ๋ถํฌ๋ช
, 00์ ์์ ํฌ๋ช
์
๋๋ค. CSS Color 4์์ ์ง์๋๋ฉฐ, ๋ณ๋์ opacity ์์ฑ ์์ด ๋ถํฌ๋ช
๋๋ฅผ ์ธ์ฝ๋ฉํ ์ ์์ต๋๋ค.
HEX๋ฅผ RGB๋ก ์ด๋ป๊ฒ ๋ณํํ๋์?
6์๋ฆฌ HEX๋ฅผ ์ธ ์์ผ๋ก ๋๋๊ณ ๊ฐ ์์ 16์ง์๋ก ์ฝ์ต๋๋ค. #4f46e5์ ์์ 4f, 46, e5์ด๋ฉฐ, ์ด๋ ๊ฐ๊ฐ 79, 70, 229๊ฐ ๋์ด rgb(79, 70, 229)๊ฐ ๋ฉ๋๋ค.
์ ์กฐ์ ์ HSL์ด RGB๋ณด๋ค ๋์๊ฐ์?
์ฌ๋์ด ์ง์ ์กฐ์ ํ ๋๋ ๊ทธ๋ ์ต๋๋ค. HSL์ ์ง๊ฐ๋๋ ์์(hue)์ ์ฑ๋ยท๋ช ๋์ ๋ถ๋ฆฌํ๋ฏ๋ก ์์ ์์ธก ๊ฐ๋ฅํ๊ฒ ์ด๋ก๊ฒ ํ๊ฑฐ๋ ์ฑ๋๋ฅผ ๋ฎ์ถ ์ ์์ต๋๋ค. RGB๋ ์๋ก ์๊ด๋ ์ธ ์ฑ๋์ ๊ท ํ์ ๋ง์ถฐ์ผ ํด์ ๋ค๋ฃจ๊ธฐ๊ฐ ๋ ์ด๋ ต์ต๋๋ค.
๋ณํ๋ ์์ด ์๋ฒ๋ก ์ ์ก๋๋์?
์๋๋๋ค. ๋ชจ๋ ๋ณํ์ ๋ธ๋ผ์ฐ์ ์์ ์ฑ๋ ๊ฐ์ ๋ํ ์์ JavaScript ์ฐ์ ๋ก ์ด๋ฃจ์ด์ง๋๋ค. ์ ๋ก๋๋๋ ๊ฒ์ ์์ผ๋ฏ๋ก ๋ธ๋๋ ํ๋ ํธ๋ ์ฌ๋ด ๋์์ธ ํ ํฐ๊ณผ ํจ๊ป ์จ๋ ์์ ํฉ๋๋ค.