Rgb Hsl Hsv Converter
Convert units with the Rgb Hsl Hsv Converter — enter a value and get accurate converted results instantly using verified formulas.
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer
Rgb Hsl Hsv Converter
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser — no data is sent to any server.
Formula: H = atan2(sqrt(3)(G-B), 2R-G-B) | S(HSL) = delta/(1-|2L-1|) | L = (max+min)/2
Worked example — HSL(217, 89%, 61%) | HSV(217, 73%, 96%) | CMYK(73%, 45%, 0%, 4%) | Complementary: #F4C342
Formula
H = atan2(sqrt(3)(G-B), 2R-G-B) | S(HSL) = delta/(1-|2L-1|) | L = (max+min)/2
Where R, G, B are normalized to 0-1 range, max and min are the largest and smallest RGB components, delta is max minus min. Hue is computed from the dominant channel and mapped to 0-360 degrees. HSL Saturation depends on lightness, while HSV Saturation equals delta divided by max. HSV Value equals max directly.
Worked Examples
Example 1: Converting Google Blue to HSL and HSV
Problem:Google uses the brand color #4285F4 (RGB 66, 133, 244). Convert this to HSL and HSV color spaces.
Solution:Normalize RGB: R=0.259, G=0.522, B=0.957 Max=0.957 (B), Min=0.259 (R), Delta=0.698 Hue = ((0.259 - 0.522) / 0.698 + 4) x 60 = 217 degrees HSL: S = 0.698 / (1 - |2x0.608 - 1|) = 0.698 / 0.784 = 89% L = (0.957 + 0.259) / 2 = 61% HSV: S = 0.698 / 0.957 = 73%, V = 96% CMYK: C=73%, M=45%, Y=0%, K=4%
Result:HSL(217, 89%, 61%) | HSV(217, 73%, 96%) | CMYK(73%, 45%, 0%, 4%) | Complementary: #F4C342
Example 2: Checking Accessibility of Text Color
Problem:A designer wants to use #6B7280 (gray-500) text on a white background. Does it meet WCAG AA standards?
Solution:RGB: R=107, G=114, B=128 Relative luminance: 0.2126 x 0.137 + 0.7152 x 0.155 + 0.0722 x 0.199 = 0.154 Contrast with white: (1 + 0.05) / (0.154 + 0.05) = 1.05 / 0.204 = 5.14:1 WCAG AA normal text (4.5:1): PASS WCAG AA large text (3:1): PASS WCAG AAA normal text (7:1): FAIL
Result:Contrast ratio 5.14:1 passes WCAG AA for both normal and large text, but fails AAA. For AAA compliance, darken to #4B5563 (gray-600).
Frequently Asked Questions
What is the difference between RGB, HSL, and HSV color models?
RGB (Red, Green, Blue) is an additive color model used in screens and digital displays where colors are created by combining red, green, and blue light at different intensities from 0 to 255. HSL (Hue, Saturation, Lightness) describes colors using a color wheel angle (0-360 degrees), saturation percentage (how vivid the color is), and lightness percentage (how bright or dark). HSV (Hue, Saturation, Value) is similar to HSL but uses Value instead of Lightness, where Value represents the brightness of the color. HSL and HSV are more intuitive for humans because they separate the color identity (hue) from its intensity and brightness, making it easier to create color variations by adjusting individual components independently.
How is the hex color code derived from RGB values?
A hex color code is a six-character representation of an RGB color where each pair of characters represents the red, green, and blue channels in hexadecimal (base-16) notation. Each channel ranges from 00 (decimal 0) to FF (decimal 255). For example, pure red is #FF0000 because red is at maximum (FF = 255), while green and blue are at zero (00 = 0). The hex code #4285F4 breaks down to R=66 (42 hex), G=133 (85 hex), B=244 (F4 hex). Hex codes are the most common color format in web development because they are compact and widely supported in CSS, HTML, and design tools. The pound sign prefix is conventional but not always required depending on the context.
What is CMYK and how does it relate to RGB?
CMYK (Cyan, Magenta, Yellow, Key/Black) is a subtractive color model used in printing where colors are created by absorbing light rather than emitting it. While RGB adds light to create colors on screens, CMYK removes light by applying ink on paper. Converting between RGB and CMYK involves mathematical transformations, but the conversion is not perfect because the two models have different color gamuts. RGB can display some vivid colors that CMYK cannot reproduce in print, particularly bright blues and greens. When designing for print, always work in CMYK or verify your colors convert acceptably. The Key component (K) represents black ink, which is used instead of combining maximum cyan, magenta, and yellow because pure black from CMY mixing is imperfect and wastes expensive colored ink.
How do I create color variations using HSL?
HSL makes creating color variations intuitive because each component controls a different aspect of the color. To create lighter or darker shades of the same color, keep the hue and saturation constant and adjust the lightness value. Lightness of 50% gives the pure color, lower values create darker shades approaching black, and higher values create lighter tints approaching white. To create muted or pastel versions, reduce the saturation while keeping hue and lightness the same. A saturation of 100% gives the most vivid color, while 0% produces a pure gray. To create analogous color schemes, keep saturation and lightness constant and shift the hue by 15-30 degrees in either direction. This approach is far more intuitive than trying to manipulate RGB values directly.
What is WCAG contrast ratio and why does it matter?
WCAG (Web Content Accessibility Guidelines) contrast ratio measures the luminance difference between two colors, expressed as a ratio from 1:1 (identical) to 21:1 (black on white). This ratio determines how easily text can be read against a background color. WCAG 2.1 Level AA requires a minimum contrast ratio of 4.5:1 for normal text (under 18px) and 3:1 for large text (18px bold or 24px regular). Level AAA, the highest standard, requires 7:1 for normal text and 4.5:1 for large text. Meeting these requirements is legally mandated in many jurisdictions for public-facing websites and is essential for users with visual impairments, who represent approximately 8% of men and 0.5% of women with color vision deficiency. Rgb Hsl Hsv Converter shows contrast ratios against both white and black backgrounds.
What are complementary, analogous, and triadic color schemes?
These are foundational color harmony schemes derived from the color wheel. Complementary colors sit directly opposite each other on the color wheel, 180 degrees apart, creating maximum contrast and visual energy. Blue and orange, red and green are complementary pairs. Analogous colors are adjacent on the color wheel, typically 30 degrees apart, creating harmonious and cohesive combinations often found in nature. Triadic colors are evenly spaced 120 degrees apart, forming a triangle on the color wheel, producing vibrant balanced schemes. Each scheme serves different design purposes. Complementary schemes work for call-to-action elements, analogous schemes create calm unified designs, and triadic schemes provide visual richness while maintaining balance. Understanding these relationships is fundamental to effective color design in web and graphic applications.
How does relative luminance affect color perception?
Relative luminance is a measure of the perceived brightness of a color based on human visual sensitivity, calculated using weighted contributions from red, green, and blue channels. The formula weights green most heavily at 71.52%, red at 21.26%, and blue at only 7.22%, reflecting that human eyes are most sensitive to green light and least sensitive to blue. This means a pure green appears much brighter than a pure blue of the same intensity. Relative luminance ranges from 0 (black) to 1 (white) and is used to calculate contrast ratios for accessibility compliance. Understanding luminance helps explain why certain color combinations are hard to read despite looking distinct in hue. Yellow text on white, for instance, fails accessibility despite being different colors because both have high luminance values resulting in low contrast.
What is the difference between HSV and HSB color models?
HSV (Hue, Saturation, Value) and HSB (Hue, Saturation, Brightness) are identical color models with different names. The V in HSV and B in HSB refer to the same measurement. Adobe products typically use HSB terminology while most programming libraries and technical documentation use HSV. Both define colors on a cone-shaped model where the top circular face represents full brightness with varying hue and saturation, and the point at the bottom represents black. HSV/HSB differs from HSL in how it handles brightness. In HSV, a value of 100% means the color is at full brightness, while in HSL, a lightness of 100% always produces white regardless of hue and saturation. HSL 50% lightness gives the purest color, while HSV 100% value gives the brightest version of that color at the current saturation.
How do I choose accessible color combinations?
Choosing accessible colors requires systematic testing of contrast ratios against WCAG standards. Start by selecting your primary colors, then verify they meet minimum contrast ratios against their intended backgrounds. For text on backgrounds, ensure at least 4.5:1 contrast for normal text and 3:1 for large text. Use tools like this converter to check contrast ratios against white and black backgrounds. Common accessible patterns include dark text on light backgrounds, maintaining a minimum lightness difference of 40% between text and background in HSL terms. Avoid relying solely on color to convey information since 8% of males have color vision deficiency. Use additional indicators like icons, underlines, or patterns. Test your colors with color blindness simulators to ensure they remain distinguishable across different types of color vision. Many design systems publish pre-tested accessible color palettes.
Why do colors look different on different screens?
Color appearance varies across screens due to multiple technical factors. Display technology (LCD, OLED, IPS) affects how colors are rendered at the hardware level. OLED screens produce deeper blacks and more saturated colors than LCD screens. Color gamut determines the range of colors a display can reproduce. Standard sRGB covers about 35% of visible colors, while DCI-P3 covers about 45% and Adobe RGB covers about 50%. A color specified in sRGB may appear differently on a wide-gamut display if no color management is applied. Screen brightness, ambient lighting, viewing angle, and individual display calibration all affect perceived color. Operating system color profiles attempt to standardize appearance but are imperfect. For accurate color work, professional monitors are calibrated with hardware colorimeters to match standard color spaces. Web developers should design in sRGB since it is the standard web color space supported by all browsers.
References
Background & Theory
History
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer · Editorial policy
Related Calculators
🧮Hex Color Converter (HEX, RGB, HSL)
Calculate hex color converter with inputs, formulas, and instant results.
🧮Rgb to Cmyk Converter
Calculate rgb to cmyk converter with interactive inputs and clear steps.
🧮Epoch Timestamp Converter Calculator
Calculate epoch timestamp converter with inputs, formulas, and instant results.
🧮Timezone Offset Converter Calculator
Calculate timezone offset converter with inputs, formulas, and instant results.
🧮Hex Binary Converter
Calculate hex binary converter with interactive inputs and clear steps.
🧮Css Unit Converter
Calculate css unit converter with inputs, formulas, and instant results.
🧮File Size Converter
Calculate file size converter with inputs, formulas, and instant results.
🧮Json to Csv Converter
Convert JSON data to CSV format and vice versa with field mapping and delimiter options.