Color Converter RGB / HEX / HSL
Convert colors between RGB, HEX, and HSL formats instantly. Enter RGB values (0-255) and get the color expressed in all major formats, including CSS-ready notation for web development.
Color conversion is essential for web development, graphic design, and digital art. Different contexts use different color formats.
Color Formats:
- RGB (Red, Green, Blue): Each channel ranges from 0-255. Used by screens, CSS, and image editing software.
- HEX: A 6-character hexadecimal representation of RGB. Each pair represents one channel (e.g., #FF0000 = red). Most common in web development.
- HSL (Hue, Saturation, Lightness): Hue is 0-360° on the color wheel, saturation and lightness are 0-100%. More intuitive for color selection.
RGB to HEX Conversion:
Each RGB value (0-255) converts to a 2-digit hex number (00-FF). For example, RGB(255, 128, 0) = #FF8000.
RGB to HSL Conversion:
The algorithm normalizes RGB values to 0-1, finds min/max, and calculates hue (based on which channel is dominant), saturation (based on the difference between min and max), and lightness (average of min and max).