What this calculator does
Hex codes and RGB values describe the same color in two different ways. A hex code packs red, green, and blue into six characters, while rgb() spells the three channels out as numbers from 0 to 255. Design tools often show one and ask for the other. This converter translates between them, then adds the HSL view, which describes hue, saturation, and lightness as a person would talk about a color. It also expands three-digit shorthand into the full six-digit form.
How to use it
- Type or paste a hex code, such as FF8800 or #0FA3A3.
- Use either three digits, like #FFF, or six digits, like #FF8800.
- Select Convert to see rgb(), hsl(), and the normalized hex value.
- Copy the format your project needs.
- Adjust the hex and convert again to compare shades.
How it works
Example calculations
Example 1: a full hex code
#FF8800 breaks into FF, 88, and 00. FF is 255, 88 is 136, and 00 is 0, giving rgb(255, 136, 0). The largest channel is red, and the result is hsl(32, 100%, 50%), a saturated orange halfway between black and white in lightness.
Example 2: a teal shade
#0FA3A3 breaks into 0F, A3, and A3. 0F is 15 and A3 is 163, giving rgb(15, 163, 163). Red is low while green and blue are equal, giving hsl(180, 83%, 35%), a teal with high saturation.
Example 3: the short form
#FFF is shorthand for #FFFFFF. Each character is doubled, so F becomes FF, which is 255. The result is rgb(255, 255, 255), pure white, or hsl(0, 0%, 100%), where zero saturation confirms there is no color tint.
What the result means
The rgb() form is what CSS, canvas, and most image APIs use, so it is the safest format to paste into code. The hex form is shorter and easier to compare at a glance, which is why design tools and brand guides favor it. The HSL form is less literal but more intuitive: hue is the color family as an angle from 0 to 360, saturation is how vivid it is, and lightness is how close it is to white or black. None of these formats carries color management information. A hex code is a screen instruction, not a printed ink recipe, so a color that looks right on screen may print differently.
Common mistakes
- Leaving a character out, which shifts every channel after it and changes the color.
- Forgetting that the hash is optional in the input but expected in CSS.
- Assuming a three-digit code is a different color instead of shorthand.
- Treating a hex code as a print color specification when it is a screen value.
- Rounding HSL values and then converting back, which can shift the RGB result by a step.
Assumptions and limits
- Input uses the characters 0 to 9 and A to F, in upper or lower case.
- Three-digit codes are expanded by doubling each character.
- The hash prefix is optional and is ignored if present.
- RGB channels are integers from 0 to 255.
- HSL values are rounded for display and are not used to recompute the hex.
Frequently asked questions
Does a hex code need the hash symbol?
Not in this converter, which accepts FF8800 and #FF8800 alike. In CSS the hash is required, and the tool always returns the normalized value with a hash so it can be pasted directly.
What is the difference between #RGB and #RRGGBB?
The three-digit form is shorthand where each character is repeated. #FFF means #FFFFFF, and #F80 means #FF8800. The six-digit form is the full value most style guides expect.
Why do HSL numbers look different from RGB?
They describe the color in different terms rather than different units. RGB states how much red, green, and blue light to mix, while HSL states the color family, its vividness, and its lightness.
What does alpha or transparency require?
An eight-digit hex code adds a pair for opacity, and CSS also accepts rgba() and hsla(). This converter handles the six-digit and three-digit forms, so transparency needs a separate tool.
Can I use the output for print design?
Use it as a starting reference only. Print work needs a color-managed workflow with ICC profiles and often CMYK or spot colors, because a screen hex value does not describe ink on paper.
Why is my color slightly different after conversion?
HSL values are rounded for readability, and re-converting a rounded HSL value can land one step away in RGB. Use the normalized hex output when you need the exact original color.
Sources
2026 update
How to use the professional output
This page is not just a formula box. The result is designed to be checked, compared, and taken away.
- Professional worksheet. The result includes the inputs used, the method and scope, and a one-variable sensitivity check for finance calculators.
- A/B scenarios. Save two input sets in the browser and compare the primary, secondary, and breakdown figures side by side.
- Print / PDF and CSV. Print a branded worksheet, or export the year-by-year table when the calculator produces one.
The formulas and assumptions above still govern the number. The worksheet makes the estimate auditable; it does not make it a lender quote, tax return, or personalized advice.
Go deeper
