How HEX, RGB, HSL & CMYK Color Models and WCAG Contrast Work

Choosing the Right Color Model for Web UI vs. Print Design

Digital screens and printed materials produce colors using fundamentally different physics. Screens emit light using the additive RGB (Red, Green, Blue) model, where each channel ranges from 0 to 255—and web developers write those three byte values in base-16 hexadecimal notation as a 6-digit HEX code (such as #2563EB). Designers prefer HSL (Hue, Saturation, Lightness) when building UI themes because adjusting Lightness creates consistent hover states and dark-mode palettes without shifting the underlying hue. Conversely, commercial printing presses mix subtractive CMYK (Cyan, Magenta, Yellow, Key/Black) inks on paper, making RGB-to-CMYK conversion essential before sending brochures or business cards to press.

How to Pick & Convert Colors in 3 Easy Steps

  1. Select or Paste Any Color: Click the color wheel swatch, type any 3-digit or 6-digit HEX code (e.g., #FF5733), or click + Pick Color from Image to sample pixels directly from a logo or screenshot.
  2. Copy Converted Formats: Copy clean HEX, rgb(), hsl(), cmyk(), or CSS variable snippets with one click.
  3. Verify Accessibility & Harmonies: Check the WCAG 2.1 contrast ratio against white and black text, or click any generated tint, shade, or complementary swatch.

RGB-to-HEX & WCAG Contrast Ratio Formulas + Worked Example

Each two-character pair in a 6-digit HEX code converts a decimal RGB channel (0–255) into hexadecimal (00–FF):

HEX = # + Hex(R) + Hex(G) + Hex(B)  |  WCAG Contrast Ratio = ( Llighter + 0.05 ) / ( Ldarker + 0.05 )

Worked Example: Suppose a brand primary blue has RGB values R = 37, G = 99, B = 235.

Converting each channel to base-16: 37 = 2×16 + 5 → 25, 99 = 6×16 + 3 → 63, and 235 = 14×16 + 11 → EB, giving #2563EB.

Against pure white text (#FFFFFF, luminance 1.0), this blue achieves a 5.17:1 contrast ratio—passing WCAG 2.1 Level AA (minimum 4.5:1) for accessible body text and buttons.

Standard Web, UI & Brand Color Reference Chart (16 Essential Swatches)

Use this quick UI design cheat sheet to copy industry-standard HEX, RGB, and HSL codes for modern websites and apps.

Color Name HEX Code RGB Value HSL Value
Slate Dark (Text) #0F172A rgb(15, 23, 42) hsl(222, 47%, 11%)
Slate Muted #475569 rgb(71, 85, 105) hsl(215, 19%, 35%)
Pure White #FFFFFF rgb(255, 255, 255) hsl(0, 0%, 100%)
Pure Black #000000 rgb(0, 0, 0) hsl(0, 0%, 0%)
Royal Brand Blue #2563EB rgb(37, 99, 235) hsl(221, 83%, 53%)
Sky Cyan #0EA5E9 rgb(14, 165, 233) hsl(199, 89%, 48%)
Modern Teal #14B8A6 rgb(20, 184, 166) hsl(173, 80%, 40%)
Emerald Success #10B981 rgb(16, 185, 129) hsl(160, 84%, 39%)
Vibrant Green #22C55E rgb(34, 197, 94) hsl(142, 71%, 45%)
Solar Yellow #EAB308 rgb(234, 179, 8) hsl(45, 93%, 47%)
Amber Warning #F59E0B rgb(245, 158, 11) hsl(38, 92%, 50%)
Bright Orange #F97316 rgb(249, 115, 22) hsl(25, 95%, 53%)
Crimson Error #EF4444 rgb(239, 68, 68) hsl(0, 84%, 60%)
Vivid Pink #EC4899 rgb(236, 72, 153) hsl(330, 81%, 60%)
Electric Violet #8B5CF6 rgb(139, 92, 246) hsl(258, 90%, 66%)
Indigo Accent #6366F1 rgb(99, 102, 241) hsl(239, 84%, 67%)

Converting images to WebP, resizing graphics by exact pixels, or formatting JSON & Base64 strings? Explore our companion tools:

Frequently Asked Questions

Click + Pick Color from Image in the top toolbar to load any PNG, JPG, or WebP image locally onto the canvas, then click any pixel on the image. Our tool reads the exact RGB pixel values and converts them to HEX, HSL, and CMYK instantaneously.
Under WCAG 2.1 accessibility guidelines, normal body text requires a minimum contrast ratio of 4.5:1 (Level AA) and 7.0:1 (Level AAA) against its background, while large headings (18pt+ or 14pt+ bold) require at least 3.0:1.
A 3-digit CSS HEX code is shorthand where each digit is doubled—so #26E expands to #2266EE. You can type either 3-digit or 6-digit HEX codes into our HEX input box above and it will convert automatically.
Never. All image pixel sampling, color-space conversions, and contrast calculations run 100% locally inside your web browser using HTML5 Canvas and JavaScript. Your images never leave your device.