Color Code Converter

Convert HEX color codes to RGB and HSL values.

Save

Inputs

Your values stay on this device.

Results

RGB
HSLhsl(217, 91%, 60%)

Report

Export and share

Document

Copy and share

Assumptions

  • Input is expected in 3-digit or 6-digit HEX form with or without a leading `#`.
  • The tool converts from HEX outward; it does not currently accept RGB or HSL as editable inputs.
  • Alpha transparency is not part of the main calculation output, so opacity workflows still need an additional step.

Sensitivity preview

No numeric sensitivity scenarios are available.

Related Tools

View All

About this Color Converter

Colors on the web are defined in several ways. HEX is the standard 6-digit code used in CSS. RGB describes the Red, Green, and Blue light values. HSL (Hue, Saturation, Lightness) is often easier for humans to adjust. This tool converts any HEX code into RGB and HSL.

Who this calculator is for

  • Frontend developers and designers moving between HEX, RGB, and HSL while styling interfaces.
  • Design-system teams documenting brand colors in multiple CSS-friendly formats.
  • Anyone tweaking palettes manually and wanting a quicker way to understand a color value.

When to use it

  • Convert a brand HEX color into RGB for opacity work or canvas usage.
  • Translate a picked color into HSL before building lighter or darker variants.
  • Check shorthand HEX values from old codebases and normalize them into more readable outputs.

How to use this calculator

  1. Enter a HEX Code (e.g., #3b82f6).
  2. The tool calculates the RGB string (e.g., rgb(59, 130, 246)).
  3. The tool calculates the HSL string (e.g., hsl(217, 91%, 60%)).

Key assumptions

  • Input is expected in 3-digit or 6-digit HEX form with or without a leading `#`.
  • The tool converts from HEX outward; it does not currently accept RGB or HSL as editable inputs.
  • Alpha transparency is not part of the main calculation output, so opacity workflows still need an additional step.

Accuracy and testing

Review formula sources, default test cases, assumptions, unit handling, rounding rules, and changelog for this calculator.

View accuracy page

Key Features

  • HEX, RGB, HSL support
  • Handles 3-digit shorthand HEX
  • Instant conversion

Tips & Best Practices

  • Use RGB when working with digital screens.
  • Use HSL when you need to create color palettes (adjusting Lightness while keeping Hue constant).

Frequently Asked Questions

What is HSL?
HSL stands for Hue, Saturation, and Lightness. It is often easier for humans to understand and manipulate programmatically than HEX or RGB.
Can I use 3-digit HEX codes?
Yes, #F00 is a shorthand for #FF0000. This converter handles both 3-digit and 6-digit formats.
What is the Alpha channel?
The Alpha channel represents transparency. In CSS, it can be defined in RGBA (e.g., rgba(0,0,0,0.5)) or 8-digit HEX (e.g., #00000080).
Why do colors look different on different screens?
Screens use different display technologies (IPS, OLED, TN) and color spaces (sRGB, P3). Without calibration, the same hex code can appear slightly different.
What is the range for RGB values?
RGB values range from 0 to 255 for each channel (Red, Green, Blue). 0 is no color (black), and 255 is full intensity.