Color Converter (RGB, HEX, HSV, HSL) / Tool
Preview
RGB (DEC/HEX)
HSV
HSL
This is a tool that converts between color codes (hexadecimal RGB) and decimal RGB, HSV, and HSL in the color space that runs in the browser.
- Input RGB, HEX, HSV, or HSL. The output will be automatically converted to each other.
- HEX can also be entered as a 3-digit abbreviation.
e.g. #3F9 → #33FF99
Note: Conversion between RGB and HSV/HSL is irreversible. Since the number of colors that can be represented is different between RGB and HSV/HSL, they are rounded off during conversion and cannot be accurately restored.
RGB: 256 × 256 × 256 = 16,777,216 patterns
HSV: 360 x 101 x 101 = 3,672,360 patterns
RGB and HEX conversion formula
RGB represents each color in 256 steps from 0 to 255 (= 8 bits). Therefore, RGB is compatible with hexadecimal numbers, and software often uses hexadecimal numbers for representation.
In hexadecimal, colors are represented by adding # at the beginning, followed by 00 to FF (two hexadecimal digits) for red, green, and blue, in that order.
#FF9933 = rgb(255, 153, 51)
In addition, hexadecimal color codes can be specified as three-digit abbreviations in CSS and other formats.
#FF9933 = #F93
A total of six digits, two digits for each color, is abbreviated to three digits, one digit for each color, and can be used only when each digit is repeated twice.
RGB to HSV conversion formula
The maximum value of R, G, and B is MAX, and the minimum value is MIN.
Hue in HSV
The formula changes depending on whether MAX is R, G, or B.
For R:
For G:
For B:
Saturation in HSV
Value in HSV
RGB to HSL conversion formula
The definitions of MAX and MIN are the same as for HSV.
Hue in HSL
Same as HSV.
Lightness in HSL
Saturation in HSL
The formula changes with Lightness.
For :
For :
HSV to RGB conversion formula
1. Converts hue of HSV
H is treated as 0 for 360; calculate the remainder by dividing H ÷ 60 by 1.
e.g. If H is 90:
2. Converts saturation and Value of HSV
S and V are converted from percentages to decimals.
3. Determines RGB according to the value of Hue in HSV
With the exception of achromatic (S = 0), the solution is determined by the value of H.
Conditions | R | G | B |
---|---|---|---|
A | A | A | |
A | D | B | |
C | A | B | |
B | A | D | |
B | C | A | |
D | B | A | |
A | B | C |
HSL to RGB conversion formula
1. Converts hue of HSL
shall be 0 for 360.
の場合:
の場合:
2. Converts lightness of HSL
Cast a spell on L.
For :
For :
3. Determines RGB according to the value of Hue in HSL
Conditions | R | G | B |
---|---|---|---|
MAX | (H) | MIN | |
(120 - H) | MAX | MIN | |
MIN | MAX | (H - 120) | |
MIN | (240 - H) | MAX | |
(H - 240) | MIN | MAX | |
MAX | MIN | (360 - H) |