HTML Color Picker — Free Online Color Code Converter
Pick any color visually or enter a hex code and instantly get HEX, RGB, HSL, and CMYK values with CSS-ready code snippets for your web design and development projects.
Color Values
Summary: The color #3B82F6 translates to rgb(59, 130, 246) in RGB and hsl(217, 91%, 60%) in HSL format.
How to Use the HTML Color Picker
- Pick a color visually: Click on the color picker input at the top of the tool to open your browser's native color selection dialog. Navigate the color spectrum to find the exact shade you want. The picker supports the full range of approximately 16.7 million colors available in the 24-bit RGB color space. As you adjust the color, all output values update in real time.
- Enter a hex code directly: If you already have a specific color in mind, type its hex code into the Hex Code text field. Include the hash symbol (#) followed by six hexadecimal digits, such as #FF5733. The color picker, preview swatch, and all conversion outputs update immediately as you type. The tool also accepts partial hex codes, padding with zeros as needed.
- Review your color in all formats: The results panel displays your chosen color in HEX, RGB (individual channel values), HSL (hue, saturation, lightness), CMYK (cyan, magenta, yellow, black), and CSS-ready rgb() and hsl() function strings. The large preview swatch below the inputs shows the actual color at a generous size so you can evaluate it visually.
- Copy any format to your clipboard: Click the Copy button next to any color value to copy it to your clipboard instantly. The button briefly shows "Copied!" to confirm the action. Paste the value directly into your CSS stylesheet, HTML file, design application, or any other tool that accepts color codes.
The color picker works entirely in your browser with no server-side processing. Color conversions are calculated instantly using standard mathematical formulas.
Color Conversion Formulas
HEX to RGB: R = parseInt(hex[1-2], 16), G = parseInt(hex[3-4], 16), B = parseInt(hex[5-6], 16) RGB to HSL: H = arctan2 of color channels, S = delta / (1 - |2L - 1|), L = (max + min) / 2 RGB to CMYK: K = 1 - max(R/255, G/255, B/255), C = (1 - R/255 - K) / (1 - K) Color Models Explained
- HEX (Hexadecimal): A six-digit code representing red, green, and blue channels in base-16 notation. Each pair of digits ranges from 00 (0) to FF (255). The format is #RRGGBB. This is the most common color notation in web development and CSS.
- RGB (Red, Green, Blue): An additive color model where red, green, and blue light are combined at varying intensities (0-255 each) to produce colors. When all channels are at 255, the result is white. When all are 0, the result is black. This model is used by all digital screens.
- HSL (Hue, Saturation, Lightness): A more human-intuitive color model. Hue is the color angle on the wheel (0-360 degrees), saturation is the color's intensity (0-100%), and lightness is the brightness (0-100%). HSL makes it easy to find lighter or darker shades of the same color by adjusting only the lightness value.
- CMYK (Cyan, Magenta, Yellow, Key/Black): A subtractive color model used in commercial printing. Each value represents the percentage of that ink color (0-100%). Higher values mean more ink. The conversion from RGB to CMYK is approximate since the two color spaces do not overlap perfectly.
Step-by-Step Conversion Example
Convert the hex color #3B82F6 (a medium blue) to all formats:
- HEX to RGB: R = 0x3B = 59, G = 0x82 = 130, B = 0xF6 = 246, so RGB = (59, 130, 246)
- RGB to HSL: Normalize values: rN=0.231, gN=0.510, bN=0.965. Max=0.965, min=0.231, delta=0.734. H = 217 degrees, S = 91%, L = 60%, so HSL = (217, 91%, 60%)
- RGB to CMYK: K = 1 - 0.965 = 0.035 (3%). C = (1 - 0.231 - 0.035) / 0.965 = 76%. M = 47%. Y = 0%. So CMYK = (76%, 47%, 0%, 4%)
- CSS Output: rgb(59, 130, 246) and hsl(217, 91%, 60%)
All these values describe the same color. Choosing which format to use depends on your application. Use HEX or rgb() for CSS, HSL for creating color palettes, and CMYK for print preparation.
Practical Examples
Example 1: Angela Designs a Website Header
Angela is building a portfolio website and wants a vibrant blue for her header background. She uses the color picker to select #2563EB, which produces a bold, professional blue:
- HEX: #2563EB
- RGB: 37, 99, 235
- HSL: 221, 83%, 53%
- CSS: rgb(37, 99, 235)
Angela copies the hex value for her CSS file. She then adjusts the lightness in HSL to 90% for a subtle background tint (#DBEAFE) and to 20% for dark text on that background (#1E3A5F), creating a cohesive color scheme from a single base color.
Example 2: Tom Matches Brand Colors for Print
Tom's client provides a digital brand color of #10B981 (an emerald green) and needs matching CMYK values for a print brochure. He enters the hex code into the color picker:
- HEX: #10B981
- RGB: 16, 185, 129
- HSL: 160, 84%, 39%
- CMYK: 91%, 0%, 30%, 27%
Tom sends the CMYK values to the print shop. He notes that the printed color may appear slightly different from the screen version due to the gamut differences between RGB and CMYK, and requests a color proof before the full print run.
Example 3: Nina Creates an Accessible Color Palette
Nina is designing an application that must meet WCAG 2.1 AA accessibility standards. She starts with her primary brand color #6366F1 (indigo) and uses the HSL output to create accessible text and background combinations:
- Primary: #6366F1 — HSL(239, 84%, 67%) — too light for text on white
- Dark variant: HSL(239, 84%, 35%) = #1E1F8E — passes 4.5:1 contrast on white
- Light variant: HSL(239, 84%, 95%) = #EDEDFE — safe as background with dark text
By using the HSL lightness value from our picker, Nina quickly generates light and dark variants that maintain the brand hue while meeting accessibility contrast requirements. She uses the password generator for securing her design platform accounts as well.
Example 4: Derek Converts Colors for a Mobile App
Derek is developing a mobile app and needs to convert his designer's hex colors to RGB format for the native development framework. He enters #F59E0B (amber) into the picker:
- HEX: #F59E0B
- RGB: 245, 158, 11
- HSL: 38, 92%, 50%
- CMYK: 0%, 36%, 96%, 4%
Derek copies the RGB values and enters them into his platform's color constructor. The HSL values help him create tinted and shaded variants for pressed and disabled states throughout the app's interface.
Common HTML Color Reference Table
| Color Name | HEX | RGB | HSL | Use Case |
|---|---|---|---|---|
| Tailwind Blue | #3B82F6 | 59, 130, 246 | 217, 91%, 60% | Links, primary actions |
| Success Green | #10B981 | 16, 185, 129 | 160, 84%, 39% | Success states, confirmations |
| Warning Amber | #F59E0B | 245, 158, 11 | 38, 92%, 50% | Warnings, attention items |
| Error Red | #EF4444 | 239, 68, 68 | 0, 84%, 60% | Errors, destructive actions |
| Neutral Gray | #6B7280 | 107, 114, 128 | 220, 9%, 46% | Secondary text, borders |
| Pure White | #FFFFFF | 255, 255, 255 | 0, 0%, 100% | Backgrounds, cards |
Tips and Complete Guide
Choosing Colors for Web Design
Effective web color design starts with understanding color psychology and functionality. Blue conveys trust and professionalism, which is why it dominates banking and technology websites. Green signals growth and health, making it popular for financial success indicators and wellness brands. Red commands attention and urgency, making it effective for call-to-action buttons and error states. Start by choosing a primary brand color, then use HSL to create a complete palette by varying saturation and lightness while keeping the hue consistent.
A practical approach to palette creation is the 60-30-10 rule: 60% neutral colors (backgrounds, large surfaces), 30% secondary colors (cards, sections, navigation), and 10% accent colors (buttons, links, highlights). Our color picker helps you define exact values for each role and provides CSS-ready outputs for immediate implementation.
Understanding Color Spaces and Gamuts
Different devices display different ranges of colors, known as color gamuts. Standard computer monitors use the sRGB gamut, which is the default for web content. Newer displays support wider gamuts like P3, which can show more vivid greens and reds. The HEX and RGB values from our picker target the sRGB color space, which ensures consistent appearance across virtually all devices. When designing for print, the CMYK output provides a starting point, but always request a physical proof from your printer because screen colors and print colors will never match exactly.
CSS Color Best Practices
When implementing colors in CSS, use CSS custom properties (variables) to centralize your color definitions. Define your colors once using the hex values from our picker, then reference the variables throughout your stylesheet. This approach makes global color changes trivial and ensures consistency. For hover states and interactions, consider using HSL notation because you can create lighter or darker versions by simply changing the lightness value. For transparency effects, append an alpha channel to create semi-transparent overlays without changing the base color, and use the word counter to verify your CSS documentation stays concise.
Common Mistakes to Avoid
- Using too many colors on one page: Limit your palette to 3 to 5 main colors plus their tints and shades. Too many distinct colors create visual chaos and weaken brand identity. Use our picker to find harmonious combinations from a single base hue.
- Ignoring color contrast for accessibility: Text that fails WCAG contrast requirements is not only inaccessible to visually impaired users but also difficult to read for everyone in bright sunlight or on low-quality screens. Always verify your text-to-background contrast ratio meets 4.5:1 for normal text.
- Relying on color alone to convey meaning: Approximately 8% of men and 0.5% of women have some form of color vision deficiency. Never use color as the only indicator of status or action. Always supplement with text labels, icons, or patterns.
- Not testing colors on multiple devices: Colors can appear dramatically different on various screens due to calibration differences, ambient lighting, and display technology. Test your chosen colors on both desktop and mobile devices before committing to your design.
- Assuming CMYK print output will match screen appearance: The RGB and CMYK color spaces overlap but are not identical. Some vibrant screen colors are impossible to reproduce in print. Always request a color proof before ordering large print runs.
Frequently Asked Questions
HEX and RGB both describe colors using the red, green, and blue light model, but they use different notation. HEX (hexadecimal) represents each color channel as a two-digit base-16 number prefixed with a hash sign, such as #3B82F6. RGB uses decimal values from 0 to 255 for each channel, written as rgb(59, 130, 246). The values are mathematically equivalent. For example, the hex value 3B converts to the decimal value 59. HEX is more commonly used in CSS and HTML because it is more compact, while RGB is often preferred in design tools and when you need to programmatically adjust individual color channels.
HSL stands for Hue, Saturation, and Lightness. Hue is a degree on the color wheel from 0 to 360, where 0 is red, 120 is green, and 240 is blue. Saturation is a percentage indicating the color intensity, from 0% (gray) to 100% (full color). Lightness is a percentage from 0% (black) to 100% (white), with 50% being the normal color. HSL is more intuitive than RGB for human understanding because you can easily create color variations by adjusting lightness or saturation while keeping the hue constant. It is ideal for creating consistent color palettes, hover states, and accessible color schemes.
CMYK stands for Cyan, Magenta, Yellow, and Key (Black). It is a subtractive color model used in print media, while RGB is an additive model used in screens. In RGB, combining all colors at maximum intensity produces white because light is being added. In CMYK, combining all inks produces black because light is being absorbed. The conversion between RGB and CMYK is approximate because the two models represent different color gamuts. Some vibrant screen colors cannot be exactly reproduced in print, and vice versa. Our color picker provides CMYK values to help designers plan for both digital and print applications.
The Web Content Accessibility Guidelines (WCAG) 2.1 require a minimum contrast ratio of 4.5:1 for normal text and 3:1 for large text (18 point or 14 point bold). To check contrast, compare the lightness values of your foreground and background colors. As a rule of thumb, very light backgrounds (lightness above 85%) work well with dark text (lightness below 30%), and vice versa. You can use our color picker to examine the HSL lightness value and adjust accordingly. Avoid color combinations that are problematic for colorblind users, such as red-green and blue-yellow pairs without sufficient luminance contrast.
Web-safe colors are a set of 216 colors that display consistently across all monitors and browsers. They use only the hexadecimal values 00, 33, 66, 99, CC, and FF for each RGB channel. For example, #336699 is web-safe but #3B82F6 is not. Web-safe colors were important in the 1990s when most monitors could only display 256 colors. Today, virtually all devices support millions of colors, making the web-safe restriction obsolete. Modern web design uses the full range of approximately 16.7 million colors available in the 24-bit RGB color space, and our picker supports all of them.
To convert HEX to RGB, split the six-character hex code into three pairs. Each pair represents red, green, and blue respectively. Convert each pair from hexadecimal to decimal. For example, with the hex code #3B82F6: the red pair 3B converts to (3 x 16) + 11 = 59, the green pair 82 converts to (8 x 16) + 2 = 130, and the blue pair F6 converts to (15 x 16) + 6 = 246. So #3B82F6 = rgb(59, 130, 246). Our color picker does this conversion automatically along with HSL and CMYK, saving you the manual calculation.
Our color picker currently accepts input through the visual color picker and the HEX code text field. To work with specific RGB values, first convert them to HEX. Multiply each value by 1, then convert each to a two-digit hexadecimal number. For example, rgb(59, 130, 246) becomes 3B (59 in hex), 82 (130 in hex), F6 (246 in hex), giving you #3B82F6. You can use the large color preview swatch and real-time output to verify you have the right color. The picker displays all format outputs simultaneously, so once you input any color, you immediately see it in every format.
CSS supports several color function notations for specifying colors in stylesheets. The most common are rgb() for red-green-blue values, hsl() for hue-saturation-lightness values, and hexadecimal notation. Modern CSS also supports rgba() and hsla() which add an alpha channel for transparency. Our color picker outputs both rgb() and hsl() CSS-ready strings that you can copy and paste directly into your stylesheet. For example, the output hsl(217, 91%, 60%) can be pasted directly into a CSS property like color or background-color without any modification.
Related Calculators
Password Generator
Generate strong random passwords with customizable length and character types.
Word Counter
Count words, characters, sentences, and paragraphs with time estimates.
MD5 Generator
Generate MD5 hash values from any text for checksums and verification.
Random Number Generator
Generate random numbers within any range for games and decisions.
Binary Calculator
Convert between binary, decimal, octal, and hexadecimal number systems.
Hex Calculator
Perform arithmetic operations with hexadecimal numbers.
Disclaimer: This calculator is for informational and educational purposes only. Results are estimates and may not reflect exact values.
Last updated: February 23, 2026
Sources
- W3C CSS Color Module Level 4 Specification: w3.org/TR/css-color-4
- W3C Web Content Accessibility Guidelines (WCAG) 2.1: w3.org/TR/WCAG21
- MDN Web Docs — CSS Color Values: developer.mozilla.org/en-US/docs/Web/CSS/color_value