Color Converter (HEX/RGB/HSL)

Convert colors between HEX, RGB, and HSL formats. Includes a visual color picker and preview.

How to Use

  1. Enter a color value in any format (HEX, RGB, or HSL)
  2. See the converted values in all other formats instantly
  3. Use the color picker to select a color visually
  4. Copy any format with the Copy button

Frequently Asked Questions

  • What is the difference between HEX, RGB, and HSL?

    HEX uses hexadecimal notation (#FF5733). RGB defines colors by Red, Green, Blue values (0-255). HSL defines colors by Hue (0-360), Saturation (0-100%), and Lightness (0-100%).

  • Which color format should I use in CSS?

    All three formats are valid in CSS. HEX is the most compact, RGB is intuitive for mixing colors, and HSL is best for creating color variations by adjusting lightness or saturation.

  • Does this support alpha/transparency?

    The current version converts opaque colors. Support for alpha channels (RGBA, HSLA, 8-digit HEX) is planned for a future update.

  • Can I use the color picker on mobile?

    Yes, the color input uses the native color picker on all devices, including mobile browsers.

Understanding Color Formats

Digital colors can be described in multiple ways, each optimized for different use cases. The three most common formats on the web are HEX, RGB, and HSL — and knowing when to use each makes CSS work significantly easier.

HEX Colors

HEX (hexadecimal) notation encodes a color as a 6-digit string prefixed with #. Each pair of digits represents the red, green, and blue channels respectively, expressed in base-16 (0–9, A–F). For example, #FF5733 means red=255, green=87, blue=51.

HEX is the most compact format and the most widely recognized. It's the default in most design tools (Figma, Photoshop, Sketch) and the format you'll see most often when copying colors from design files.

Shorthand: When both digits of each pair are identical, you can shorten to 3 characters: #FF6600 becomes #F60.

RGB Colors

RGB defines a color by specifying the intensity of its red, green, and blue components on a scale from 0 to 255. The format is rgb(red, green, blue).

RGB is intuitive for understanding how colors mix — rgb(255, 0, 0) is pure red, rgb(0, 255, 0) is pure green. It also supports transparency via rgba(red, green, blue, alpha), where alpha is a value between 0 (fully transparent) and 1 (fully opaque).

HSL Colors

HSL describes a color using Hue, Saturation, and Lightness. The format is hsl(hue, saturation%, lightness%).

  • Hue is the color angle on a 360° wheel (0°=red, 120°=green, 240°=blue)
  • Saturation is how vivid the color is (0%=gray, 100%=full color)
  • Lightness is how bright the color is (0%=black, 50%=normal, 100%=white)

HSL is the most useful format for programmatic color manipulation. To create a lighter version of a color, just increase the lightness. To create a muted variation, decrease the saturation. This makes HSL invaluable for building color systems and generating palettes in code.

Choosing the Right Format

Use case Recommended format
Copying from a design tool HEX
Adding transparency RGBA
Generating color variations in code HSL
Defining a design system HSL or CSS custom properties