Color Code Generator
Pick and convert between HEX, RGB, and HSL color codes
Color Picker
Color Codes
Current Color
#3b82f6
HEX
RGB
HSL
Color Information
HEX Color Codes
Hexadecimal codes are 6-digit codes representing the intensity of red, green, and blue (RRGGBB), prefixed with a # symbol. Values range from 00 to FF.
RGB Color Codes
RGB stands for Red, Green, Blue. Each parameter defines the intensity between 0-255. For example, rgb(255, 0, 0) is pure red.
HSL Color Codes
HSL stands for Hue (0-360), Saturation (0%-100%), and Lightness (0%-100%). It’s a more intuitive way to describe colors.
Recent Colors
Understanding Color Codes: HEX, RGB & HSL
Color codes are essential for web design, graphic design, and digital art. Three of the most common formats are HEX, RGB, and HSL. Each represents colors in a different way, and being able to convert between them gives you flexibility. Our tool instantly converts any color you pick into all three formats, with copy buttons for easy use in your CSS or design software.
🧮 Conversion Formulas
- HEX → RGB: Split the 6‑digit hex into pairs (RR, GG, BB). Convert each pair from base‑16 to decimal. Example:
#3b82f6→ 3B=59, 82=130, F6=246 →rgb(59,130,246). - RGB → HEX: Convert each decimal value to a two‑digit hexadecimal (pad with leading zero if needed) and concatenate with a #. Example:
rgb(59,130,246)→ 59=3B, 130=82, 246=F6 →#3b82f6. - RGB → HSL: Normalize R,G,B to 0‑1, find min, max, delta. Hue is calculated from the dominant channel, saturation from delta and lightness, lightness = (max+min)/2. (Our script implements this exactly.)
- HSL → RGB: Uses chroma, hue sector, and lightness to compute R,G,B. The math ensures accurate conversion back to RGB.
🎯 Why Different Formats?
• HEX is compact and widely used in CSS and HTML.
• RGB is based on how screens emit light; it’s great for programmatic color manipulation.
• HSL is more human‑readable – you can easily make a color lighter/darker by adjusting lightness, or change its vividness by altering saturation.
❓ Frequently Asked Questions
Q: What does “HEX” stand for?
HEX is short for hexadecimal, a base‑16 numbering system. Color codes use six hex digits to represent the red, green, and blue components.
Q: How do I use these codes in CSS?
All three formats are valid in CSS. For example: color: #3b82f6; or color: rgb(59,130,246); or color: hsl(217,91%,60%);.
Q: Why does HSL make it easier to create color schemes?
Because you can keep the same hue (color tone) and only adjust saturation and lightness to generate lighter/darker variants, or complementary colors by shifting the hue by 180°.
Q: Are there any color codes not supported by this tool?
This tool supports standard 6‑digit HEX, 3‑digit HEX (e.g., #fff), and CSS‑style rgb() and hsl() with percentages or integer values. It does not support CMYK or named colors, but you can easily convert them first.
Q: Can I save my favorite colors?
Yes! Your last 10 selected colors are stored in your browser’s local storage under “Recent Colors”. They will persist even after you close the page.
⚠️ Disclaimer
Finance ToolBajar’s Color Code Generator is provided for informational and design purposes only. While we strive for accurate conversions, slight rounding differences may occur. Colors displayed on your screen may vary due to monitor calibration. We are not responsible for any color mismatches in your projects.
© 2025 Finance ToolBajar. All rights reserved.