🛠️ Developer · Updated October 11, 2026 · 5 min read

How to Convert RGB to HEX (Free Color Tool + Method)

RGB HEX 🎨

To convert RGB to HEX, write each of the three channel values (0 to 255) as a two-digit hexadecimal number and join them after a #. So rgb(37, 99, 235) becomes 25, 63 and EB, or #2563EB. The tool does it in one step, but knowing the method helps you spot mistakes, understand shorthand like #fff and read the eight-digit form with transparency. This guide covers the manual method, a worked example, the reverse conversion, what to do with HSL and named colors, and the steps in GrabCast's free Color Converter with screenshots.

🎨 Try Color Converter (HEX RGB HSL) now — freeOpen →
Color converter with the emerald green rgb(16, 185, 129) converted to hex, HSL, HSV and CMYK values
The finished conversion.
💡 Why designers and developers keep converting

Design tools often show RGB, style sheets and brand guides often use HEX, and a client may send a color in either. Hex codes are compact and easy to paste, while RGB is easier to reason about (three channels of red, green and blue). Having a reliable way to move between them, and to check the result by eye, saves rework and keeps a brand color identical everywhere.

How the conversion works

Each of red, green and blue is a number from 0 to 255. Hexadecimal counts in sixteens, using digits 0 to 9 and letters A to F (A = 10 through F = 15). Divide each value by 16: the whole number is the first digit and the remainder is the second.

Join them: #2563EB. The converter shows the same result in the HEX row when you type rgb(37, 99, 235). Hex is not case sensitive, so #2563eb is identical.

More RGB to HEX examples

The screenshots show these conversions in the real tool:

Pure values are easy to memorise: 0 is 00, 255 is FF, and 128 is 80. So rgb(0, 0, 0) is #000000 (black), rgb(255, 255, 255) is #FFFFFF (white) and rgb(255, 0, 0) is #FF0000.

Shorthand, transparency and the reverse

When each pair repeats, a hex code can be written with three digits: #FFFFFF is #FFF, and #3366CC is #36C. #2563EB has no repeated pairs, so it has no short form. An eight-digit code adds a final alpha pair for transparency: #2563EB80 is the same blue at about 50 percent opacity (80 hex is 128 of 255).

To reverse the conversion, split the code into pairs and turn each into decimal: E × 16 + B = 14 × 16 + 11 = 235. The converter also accepts HSL, HSV, CMYK and CSS names, so you can paste whatever format you were given and copy the one you need.

Checking the result

Compare the swatch beside the input with your source. If the color looks off, check that you typed the channel order as red, green, blue and that values are between 0 and 255. Do not round percentages when a design gives rgb(37 99 235 / 50%); use the alpha pair instead. If you plan to use the color for text, check its contrast with the background in the Color Contrast Checker: the blue above has a contrast ratio of 5.17 to 1 with white, which passes for normal text. For converting in the other direction, see HEX to RGB.

Using the code in CSS, design tools and documents

In CSS a hex color is written with a leading hash: color: #2563EB;. Modern CSS also accepts rgb(37 99 235) and hsl(221 83% 53%), so you can keep whichever format your team prefers. Design apps such as Figma and Canva accept a pasted HEX code in their color fields, and word processors usually have a custom color box that takes the same six characters. When you paste, drop the # only if the field asks for it.

Keep one source of truth: store the brand colors in a style guide with HEX, RGB and CMYK side by side, and copy from it rather than converting each time. If two people convert the same color independently and round HSL values, small differences creep in that are visible when two elements sit next to each other.

Reading a six-digit code at a glance

With practice you can estimate a shade from its code. The first pair is the red amount, the middle pair is green and the last pair is blue, each running from 00 for none to FF for full strength. Equal pairs give a grey, so #808080 is mid grey and #222222 is a near black. A high first pair with low others gives a warm tone, and a high last pair gives a cool one.

Where designers and developers keep their values

Teams usually store brand shades as variables so a change happens in one place. In a stylesheet that is a custom property near the top of the file, in a design tool it is a shared style, and in documentation it is a small table listing the name, the six-digit code, the channel numbers and the lightness. Keeping all three notations in the table saves time when a tool wants one format and a colleague prefers another.

For deeper background, see the HEX to RGB and HSL maths, and choosing a palette for your brand to decide which values belong in the table. When you need to sample a shade from artwork, extracting a palette from an image is quicker than guessing.

Mistakes that cause a wrong shade

Typing letters in the wrong order is the classic slip, for example blue first. Another is forgetting that the three-digit shorthand doubles each digit, so #09C is #0099CC and not #090C00. Leaving out the hash in a stylesheet makes the declaration invalid, while adding spaces inside a code breaks it silently. Finally, remember that a screen shows the value in its own profile, so a printed proof may look duller than the display.

Working with brand guidelines and accessibility

Large organisations publish a brand book that lists approved shades, usually in several notations. Always take values from that source instead of sampling a logo, because compression and lighting change what you see. If a guideline gives only a print specification, ask the design team for the screen equivalents so websites, slides and apps remain consistent.

Remember that people with reduced vision need strong contrast between letters and their backgrounds. A pleasant combination that looks elegant in a mock-up may be hard to read on a phone in sunlight. Check ratios early, before the design is approved, and keep a fallback pairing for small type.

A quick routine when a client sends a shade

Clients often send a code in a different notation from the one your tool expects. Ask for a swatch or screenshot too, confirm the value on screen, and record the agreed version with the date. If a printed sample looks different, remember that paper and ink behave differently from light, and ask the printer for a proof before approving a run.

Step-by-step

1234
1Open the Color Converter and type or paste your value in the color box, for example rgb(37, 99, 235).
Color converter with rgb(37, 99, 235) typed into the color value box next to the picker
Type the RGB value exactly as a designer sent it.
2Read the HEX row (#2563EB) and click Copy next to it. RGB, HSL, HSV and CMYK are shown at the same time.
Converted values for rgb(37, 99, 235) with the HEX row reading #2563EB
The HEX row is the answer; copy it with one click.
3Try another format: paste hsl(347, 90%, 61%) and read #F54269, or type a CSS color name.
A rose-red entered as HSL, hsl(347, 90%, 61%), converted to hex #F54269
Any format goes in: HSL, HSV, CMYK, HEX or a color name.
4Type a name such as tomato to see its hex code, #FF6347, and its RGB values.
The color name tomato typed in, converted to hex #FF6347 and its RGB values
Even CSS color names convert.

Common mistakes to avoid

⚠️Writing the channels in the wrong order, for example green first.
⚠️Forgetting the leading zero: 5 is 05, not just 5.
⚠️Entering percentages (rgb(50%, 60%, 70%)) as if they were 0 to 255 values.
⚠️Using a 6-digit code when an 8-digit one with alpha was needed.

Pro tips

✓Hex is case insensitive, so pick one style and stay consistent.
✓0 is 00, 128 is 80 and 255 is FF, which helps you read codes at a glance.
✓Use HSL when you need to make a lighter or darker version of a color.
✓Copy the exact code from the tool instead of retyping it.
✓Check contrast for any color used behind or as text.

Frequently asked questions

How do I convert RGB to HEX?

Convert each of red, green and blue to a two-digit hexadecimal number and join them after a #. rgb(37, 99, 235) is #2563EB.

What is rgb(255, 255, 255) in hex?

It is #FFFFFF, or #FFF in shorthand: white.

Are hex color codes case sensitive?

No. #2563EB and #2563eb are the same color.

Can a hex code include transparency?

Yes. An eight-digit code adds two alpha digits: #2563EB80 is about 50 percent opaque.

Is the Color Converter free?

Yes. It is free, needs no account and runs in your browser.

📌 Bottom line

RGB to HEX means turning three 0 to 255 numbers into three two-digit hex pairs. Learn the divide-by-16 method for checking, let the Color Converter do the work and copy the exact code so a brand color stays the same everywhere.

Open Color Converter (HEX RGB HSL) →

Related guides

Browse more: all text and developer guides · Color Converter (HEX RGB HSL)