Skip to main content
FreeOnlineTools Go
English
how-to

How to Convert Colors Between HEX, RGB, and HSL

By FreeOnlineTools Team · Updated 2026-09-02

Quick Answer

To convert a color: open the Color Converter, enter a color in any format (HEX, RGB, HSL), and the tool displays the equivalent in all other formats instantly. All conversion happens locally in your browser — no data is uploaded.

Introduction

Colors can be represented in multiple formats: HEX (#ff6600), RGB (rgb(255, 102, 0)), HSL (hsl(24, 100%, 50%)), and others. Different tools and contexts use different formats — CSS often uses HEX or RGB, design tools may use HSL, and APIs may use any. Converting between formats lets you use a color defined in one system in a context that requires another. This guide shows you how to convert colors in your browser.

Step by Step

  1. Open the Color Converter tool

    Go to the Color Converter tool page. The tool supports HEX, RGB, HSL, HSV, and CMYK formats.

  2. Enter your color

    Type or paste a color value in any supported format. Examples: '#ff6600', 'rgb(255, 102, 0)', 'hsl(24, 100%, 50%)'. The tool auto-detects the input format.

  3. Review all format equivalents

    The tool displays the color in all formats simultaneously: HEX, RGB, HSL, HSV, and CMYK. It also shows a color preview swatch so you can verify the conversion is correct.

  4. Copy the format you need

    Click the Copy button next to any format to copy that value to your clipboard. Use it in your CSS, design tool, or application.

  5. Adjust the color (optional)

    Some tools let you adjust the color with sliders (for HSL: hue, saturation, lightness) and see all formats update in real time. This is useful for finding related colors or shades.

Examples

HEX to RGB and HSL

Input: #ff6600

Output: RGB: rgb(255, 102, 0) HSL: hsl(24, 100%, 50%)

RGB to HEX

Input: rgb(0, 128, 255)

Output: HEX: #0080ff HSL: hsl(210, 100%, 50%)

HSL to HEX

Input: hsl(120, 100%, 50%)

Output: HEX: #00ff00 RGB: rgb(0, 255, 0)

Common Problems

  • HEX with vs without # —some tools require the # prefix, others do not. Our converter accepts both.
  • 3-digit vs 6-digit HEX —#f60 is shorthand for #ff6600. Both are valid; the converter normalizes to 6 digits.
  • HSL hue range —hue is 0-360 degrees (a circle). 0 and 360 are both red. Values above 360 wrap around.
  • Color space differences —HEX, RGB, and HSL are all sRGB. CMYK is a different color space (print) and conversion is approximate.

Tips

  • Use HSL for creating color variations —adjusting hue, saturation, or lightness is more intuitive than RGB.
  • Use HEX for CSS —it is the most compact and widely supported format in stylesheets.
  • Use RGB when you need to set alpha transparency —rgb(255, 102, 0, 0.5) for 50% opacity (or use 8-digit HEX: #ff660080).
  • Use our Color Converter for instant, private conversion between all color formats.

Related Tools

Related Guides

References