HEX to RGB Converter — Convert Color Codes Free (HEX, RGB, HSL, CMYK)

Convert any HEX color to RGB, HSL, CMYK, HSV, Tailwind, Swift, Flutter and 10 other formats instantly. Includes the conversion formula, a reference table for 15 common colors, and a free browser-based converter — no upload, no signup.

Published May 7, 2026 · 9 min read
Convert any color instantly — HEX, RGB, HSL, CMYK, Tailwind, Swift, Flutter
17+ formats · No signup · Nothing uploaded · 100% browser-based
Open Color Converter →

What Is a HEX Color Code?

A HEX color code is a 6-digit hexadecimal number prefixed with #that represents a color in web design — for example, #E8720C is an orange. The six digits are split into three pairs: the first two represent red, the middle two represent green, and the last two represent blue.

Each pair is a base-16 number ranging from 00 (0 in decimal) to FF (255 in decimal), which gives 256 possible values per channel and over 16 million possible colors in total. HEX is the most widely used color format in CSS and HTML — every browser and design tool understands it.

HEX codes can also be written in 3-digit shorthand when both digits of each channel are identical: #ffffff becomes #fff,#000000 becomes #000. All browsers support both forms.

What Is RGB?

RGB stands for Red, Green, Blue — the three primary colors of light. In CSS, it is written as rgb(R, G, B) where each value is an integer from 0 to 255. RGB is the native color model of screens: every pixel on your monitor mixes these three light wavelengths to produce color.

rgb(255, 0, 0) is pure red, rgb(0, 0, 255) is pure blue, rgb(0, 0, 0) is black, and rgb(255, 255, 255) is white. RGBA adds a fourth value for opacity: rgba(232, 114, 12, 0.5) is the same orange at 50% transparency.

HEX to RGB — The Formula and How It Works

Converting HEX to RGB is a base conversion from hexadecimal (base 16) to decimal (base 10). You split the 6-digit HEX code into three 2-digit pairs and convert each one independently.

Example — convert #E8720C to RGB
1
Split HEX into pairs
#E8720C → E8, 72, 0C
2
Convert each pair from base-16 to base-10
E8 = 14×16 + 8 = 232, 72 = 7×16 + 2 = 114, 0C = 0×16 + 12 = 12
3
Assemble RGB
rgb(232, 114, 12)

In JavaScript: parseInt("E8", 16) === 232. For any HEX color #RRGGBB: R = parseInt(hex.slice(1,3), 16), G = parseInt(hex.slice(3,5), 16), B = parseInt(hex.slice(5,7), 16).

RGB to HEX — The Formula

To go the other direction — RGB to HEX — you convert each decimal value (0–255) to a 2-digit hexadecimal number and join them with a # prefix.

Example — convert rgb(232, 114, 12) to HEX
1
Divide each value by 255 to get 0–1 range
232/255 = 0.910, 114/255 = 0.447, 12/255 = 0.047
2
Convert each decimal to hex (multiply by 255 if going back)
Math.round(0.910 × 255) = 232 → 0xE8
3
Concatenate with # prefix
#E8720C
In JavaScript: "#" + [232,114,12].map(v => v.toString(16).padStart(2,"0")).join("") === "#e8720c"

How to Convert HEX to RGB Online (Step-by-Step)

1
Open the Color Converter
Go to toollance.com/tools/color-picker and click the Color Converter tab on the right.
2
Enter your HEX code
Type or paste your HEX code into the HEX field (with or without the # prefix).
3
Read all formats instantly
RGB, RGBA, HSL, HSLA, HSV, CMYK, CSS variable, Tailwind, iOS/Swift, Flutter, Android ARGB, and luminance all update in real time.
4
Copy what you need
Click Copy next to any format. One click — no selecting, no reformatting.

All Color Formats — What Each One Is and When to Use It

Different workflows require different color formats. Here is every major format, what it looks like, and where it is used:

FormatExampleUsed inNotes
HEX#e8720cCSS, HTML, design tools6-digit hexadecimal. Two digits each for red, green, blue. Most common web format. Can be shortened to 3 digits when each pair is identical (#fff = #ffffff).
RGBrgb(232, 114, 12)CSS, JavaScript, CanvasRed, Green, Blue values from 0–255. The native format of screens. RGBA adds a fourth value (0–1) for opacity.
HSLhsl(28, 90%, 48%)CSS, design toolsHue (0–360°), Saturation (0–100%), Lightness (0–100%). Most human-intuitive — you can adjust brightness independently of hue.
HSV / HSBhsv(28, 95%, 91%)Photoshop, Figma, SketchHue, Saturation, Value/Brightness. Used in design tool color pickers. Value 100% = the full color; 0% = black.
CMYKcmyk(0%, 51%, 95%, 9%)Print, InDesign, IllustratorCyan, Magenta, Yellow, Key (Black). Subtractive color model for physical printing. Gamut is smaller than RGB.
Tailwind CSSorange-500Tailwind CSS frameworkNamed utility classes. The nearest Tailwind color to any HEX is an approximation — Tailwind has a fixed palette of ~22 colors × 11 shades.
iOS / SwiftUIColor(red: 0.910, green: 0.447, blue: 0.047, alpha: 1.0)Swift, Objective-C, SwiftUIRGB values expressed as decimals 0.0–1.0. SwiftUI also accepts Color(red:green:blue:) with the same values.
Flutter / DartColor(0xFFE8720C)Flutter, Dart0xFF prefix for full opacity followed by the 6-digit HEX. Change FF to control alpha (e.g. 0x80 = 50% opacity).
Android ARGB0xFFE8720CAndroid XML, Kotlin, JavaSame as Flutter format. Alpha first (FF = opaque), then RGB. In XML: android:color="#FFE8720C".

Common Color Reference Table — HEX, RGB, and HSL

A quick reference for 15 frequently used colors in web design — pure colors, common named colors, and Tailwind CSS defaults:

ColorSwatchHEXRGBHSL
White
#FFFFFFrgb(255, 255, 255)hsl(0, 0%, 100%)
Black
#000000rgb(0, 0, 0)hsl(0, 0%, 0%)
Red
#FF0000rgb(255, 0, 0)hsl(0, 100%, 50%)
Lime
#00FF00rgb(0, 255, 0)hsl(120, 100%, 50%)
Blue
#0000FFrgb(0, 0, 255)hsl(240, 100%, 50%)
Yellow
#FFFF00rgb(255, 255, 0)hsl(60, 100%, 50%)
Tomato
#FF6347rgb(255, 99, 71)hsl(9, 100%, 64%)
Blue-500 (Tailwind)
#3B82F6rgb(59, 130, 246)hsl(217, 91%, 60%)
Green-500 (Tailwind)
#22C55Ergb(34, 197, 94)hsl(142, 71%, 45%)
Orange-500 (Tailwind)
#F97316rgb(249, 115, 22)hsl(25, 95%, 53%)
Indigo-500 (Tailwind)
#6366F1rgb(99, 102, 241)hsl(239, 84%, 67%)
Pink-500 (Tailwind)
#EC4899rgb(236, 72, 153)hsl(330, 81%, 60%)
Gray
#808080rgb(128, 128, 128)hsl(0, 0%, 50%)
Orange
#FFA500rgb(255, 165, 0)hsl(39, 100%, 50%)
Purple
#800080rgb(128, 0, 128)hsl(300, 100%, 25%)

What Is HSL and Why Is It Useful?

HSL (Hue, Saturation, Lightness) is the color format that most closely matches how humans think about color. Instead of specifying red, green, and blue phosphor intensities, you specify:

  • Hue (0–360°) — The color itself on the color wheel. 0° = red, 120° = green, 240° = blue.
  • Saturation (0–100%) — How vivid or gray the color is. 0% = pure gray, 100% = full color.
  • Lightness (0–100%) — How light or dark. 0% = black, 50% = the pure color, 100% = white.

HSL is especially useful in CSS when you want to create variants of a color. To make a color darker, reduce L. To make it lighter, increase L. The hue stays identical. This is why design systems often store brand colors in HSL and generate shade scales by varying L and S.

HEX #E8720C = RGB rgb(232, 114, 12) = HSL hsl(28, 90%, 48%). All three are the same orange — just described differently.

CMYK — When You Need It and When You Don't

CMYK (Cyan, Magenta, Yellow, Black) is a subtractive color model used in physical printing. Unlike RGB which mixes light, CMYK mixes ink — adding more ink makes the color darker. You need CMYK values when:

  • Sending files to a professional print shop
  • Working in Adobe InDesign or Illustrator for print output
  • Creating brand guidelines that specify both digital (RGB) and print (CMYK) values

CMYK is not needed for anything displayed on a screen — websites, apps, social media, presentations. For screen use, HEX or RGB is always correct. Note that RGB colors cannot be perfectly reproduced in CMYK — the CMYK gamut is smaller, so very vivid screen colors may look duller in print.

Color Formats for iOS, Android, and Flutter

When you are handing off a design to a mobile developer, they need platform-specific formats — not CSS HEX codes. Here is what each platform uses and how it maps to HEX:

iOS / Swift
UIColor(red: 0.910, green: 0.447, blue: 0.047, alpha: 1.0)
RGB values divided by 255 to get 0.0–1.0 range. SwiftUI uses Color(red:green:blue:) with the same values.
Flutter / Dart
Color(0xFFE8720C)
0xFF prefix = fully opaque. Replace FF with a hex alpha value for transparency (0x80 = 50%).
Android (Kotlin / XML)
0xFFE8720C / android:color="#FFE8720C"
Same format as Flutter. In XML resources, just use the #FFE8720C string directly.
CSS Custom Property
--brand-primary: #E8720C;
Best practice for web — store colors as CSS variables so they can be reused and themed.

The Color Converter tab outputs all of these formats simultaneously — paste in a HEX code and copy iOS, Android, and Flutter values in one step.

Related Tools

After converting your colors, you may want to check whether your text and background color combination meets accessibility standards — the WCAG Contrast Checker (in the Contrast Checker tab) gives you an instant pass/fail for WCAG AA and AAA. If you need a complete color palette for a project, the Palette Generator creates analogous, complementary, and triadic schemes from any base color. For gradient CSS, the Gradient Generator builds linear, radial, and conic gradients with a live preview.

Frequently Asked Questions

How do I convert HEX to RGB?

Split the 6-digit HEX code into three pairs and convert each from base-16 to base-10. Example: #E8720C → E8=232, 72=114, 0C=12 → rgb(232, 114, 12). Use the Color Converter tool to do this instantly for any color.

How do I convert RGB to HEX?

Convert each R, G, B value (0–255) to a 2-digit hexadecimal number and join them with a # prefix. Example: rgb(232, 114, 12) → E8, 72, 0C → #E8720C. In JavaScript: (232).toString(16) === "e8".

What is the difference between HEX and RGB?

HEX (#RRGGBB) and RGB (rgb(R,G,B)) represent the same color in different notation. HEX is more compact; RGB is easier to manipulate numerically. Both are fully supported in CSS — choose whichever your workflow requires.

What is HSL and how is it different from RGB?

HSL (Hue, Saturation, Lightness) describes colors in human-intuitive terms. You can make a color lighter by raising L, or more vivid by raising S, without changing the hue. RGB describes colors as screen phosphor intensities — less intuitive for manual adjustment.

Can HEX codes be 3 digits?

Yes. #abc is shorthand for #aabbcc — it only works when both digits in each channel pair are identical. #fff = #ffffff (white), #000 = #000000 (black), #f00 = #ff0000 (red).

What is CMYK and when do I need it?

CMYK is the color model for print. You need CMYK values when sending files to a print shop or working in InDesign/Illustrator for physical output. For anything displayed on a screen, use RGB or HEX.

How do I use a HEX color in Swift?

Divide each RGB value by 255. Example: #E8720C = rgb(232,114,12) → UIColor(red: 0.910, green: 0.447, blue: 0.047, alpha: 1.0). The Color Converter generates this format automatically.

How do I use a HEX color in Flutter?

Use Color(0xFFRRGGBB) where FF is the alpha (opacity) and RRGGBB is your HEX without the #. Example: #E8720C → Color(0xFFE8720C). Change FF to 80 for 50% opacity.