Color Converter

Convert colors between HEX, RGB, and HSL formats instantly. Use the visual color picker, explore complementary colors and shade variations, copy CSS code, and browse preset palettes from Material Design and Tailwind CSS -- all client-side in your browser.

No color selected

How It Works

🎨

Auto-Detect Format

Paste any color value -- HEX, RGB, or HSL -- and the tool automatically detects the format and converts it to all three representations simultaneously. No need to specify the input type.

🖌

Visual Color Picker

Use the built-in HTML5 color picker to select colors visually. The picker updates all outputs in real time as you drag through the color space, making it easy to find the perfect shade.

🌈

Shades & Complements

Instantly see 5 lighter and 5 darker shade variations of any color, plus the complementary color on the opposite side of the color wheel. Click any swatch to load that color.

📋

CSS Code Ready

Get copy-paste-ready CSS declarations for your color in all three formats. Copy individual values or the full CSS block with a single click to use directly in your stylesheets.

Understanding Color Formats

Colors on the web can be expressed in several formats. The three most common are HEX, RGB, and HSL. Each represents the same colors but uses different models, and choosing the right one depends on your use case. This tool converts between all three formats instantly, making it easy to work with colors across design tools, CSS, and JavaScript.

HEX Colors

HEX (hexadecimal) is the most common color format in CSS. It uses a hash symbol followed by six hexadecimal digits representing red, green, and blue channels (e.g., #FF5733). A shorthand form uses three digits when each pair is identical (e.g., #F00 is the same as #FF0000). HEX values range from 00 (0) to FF (255) for each channel.

RGB Colors

RGB (Red, Green, Blue) specifies colors using decimal values from 0 to 255 for each channel (e.g., rgb(255, 87, 51)). This is a direct representation of how screens display color by mixing light from red, green, and blue subpixels. RGB is intuitive when you need to adjust individual channels programmatically.

HSL Colors

HSL (Hue, Saturation, Lightness) describes colors using three properties: hue as a degree on the color wheel (0-360), saturation as a percentage (0% is gray, 100% is fully saturated), and lightness as a percentage (0% is black, 100% is white, 50% is the pure color). HSL is the most human-readable format and makes it easy to create color variations by adjusting lightness or saturation.

How to Use This Tool

Type or paste a color value in any supported format into the input field. The tool auto-detects whether it is HEX, RGB, or HSL and instantly displays the converted values in all three formats. Use the color picker for visual selection. Click any output value to copy it. The complementary color, shade variations, and CSS code are generated automatically. Browse the Material Design or Tailwind CSS preset palettes and click any swatch to load that color.

Common Use Cases

Frequently Asked Questions

How do I convert HEX to RGB?
A HEX color code like #FF5733 represents red, green, and blue channels in hexadecimal. To convert manually, split the 6-digit hex into three pairs: FF (red = 255), 57 (green = 87), 33 (blue = 51). The result is rgb(255, 87, 51). Our tool does this conversion instantly -- just paste any HEX value and the RGB and HSL equivalents appear automatically.
What is the difference between HEX, RGB, and HSL?
HEX uses a 6-character hexadecimal string (e.g., #FF5733) to represent colors. RGB specifies red, green, and blue channel values from 0 to 255 (e.g., rgb(255, 87, 51)). HSL uses hue (0-360 degrees on the color wheel), saturation (0-100%), and lightness (0-100%) (e.g., hsl(11, 100%, 60%)). All three describe the same set of colors but in different models. HEX is the most compact, RGB is closest to how screens work, and HSL is the most intuitive for humans when adjusting brightness or creating color scales.
What is a complementary color?
A complementary color sits directly opposite another color on the color wheel, exactly 180 degrees apart in hue. Complementary pairs create maximum contrast and visual energy when used together. For example, the complement of blue (hue 240) is orange (hue 60), and the complement of red (hue 0) is cyan (hue 180). Designers use complementary colors to create vibrant call-to-action buttons, highlight important elements, or build balanced color schemes. Our tool automatically calculates and displays the complementary color for any input.
How do I use the color picker?
Click the rectangular color swatch next to the text input to open your browser's native color picker dialog. You can drag through the color space to select any color visually. As you pick colors, the tool instantly updates all outputs including the HEX, RGB, and HSL values, the preview swatch, complementary color, shade variations, and CSS code. You can also type a color value directly into the text field in any supported format (HEX, RGB, or HSL), and the color picker will update to match.
Can I get CSS code for a color?
Yes. After entering or selecting a color, the tool generates ready-to-use CSS property declarations including color in HEX format, background-color in RGB format, and border-color in HSL format. Click the "Copy CSS" button to copy all three declarations to your clipboard for immediate use in your stylesheets. You can also copy individual HEX, RGB, or HSL values using the Copy buttons next to each output row.
What color formats does this tool support?
The tool auto-detects and accepts HEX codes (#RGB or #RRGGBB, with or without the hash symbol), RGB values (rgb(R, G, B)), and HSL values (hsl(H, S%, L%)). It also accepts rgba() and hsla() syntax, ignoring the alpha channel for conversion purposes. All conversions happen instantly and entirely in your browser -- no data is sent to any server.
What are the preset palettes available?
The tool includes two popular color palettes: Material Design with 19 primary colors from Google's Material Design system (Red, Pink, Purple, Indigo, Blue, Teal, Green, Amber, Orange, and more), and Tailwind CSS with 22 colors at the 500 shade level from the Tailwind CSS framework (Slate, Red, Orange, Amber, Emerald, Cyan, Blue, Violet, Pink, Rose, and more). Click any preset swatch to instantly load that color into the converter and see all its format conversions, complementary color, and shade variations.

Explore More Developer Tools

Check out our other free developer tools. Format JSON, decode JWTs, parse cron expressions, and more -- all from your browser with no sign-up required.

JSON Formatter →