Home / Blog / HEX to RGB: How to Convert HEX Codes to RGB (With Examples)

HEX to RGB: How to Convert HEX Codes to RGB (With Examples)

By Editorial Team | Dec 4, 2026

Learn how to convert HEX codes to RGB step by step, with worked examples for #FF5733, #2F7BFF, white and black.

You will see the same color written in two different ways on the web: as a HEX code such as #FF5733, and as an RGB value such as rgb(255, 87, 51). They describe the exact same color. Converting between them is a simple skill, and once you know the method you can do it by hand in under a minute.

This guide explains what each format is, shows the step-by-step conversion method, works through four examples with the math checked, and points out the mistakes that catch beginners most often.

What HEX and RGB Mean

A HEX code is a six-character code that starts with a hash sign. The six characters are split into three pairs. The first pair is red, the second pair is green, and the third pair is blue. Each pair uses the hexadecimal system, which counts in base 16 with the digits 0 to 9 and the letters A to F.

RGB is the same idea written in decimal numbers. It lists the red, green and blue values as numbers from 0 to 255, inside the rgb() function. So #FF5733 and rgb(255, 87, 51) are two ways of writing one color: a bright orange-red.

How to Convert HEX to RGB Step by Step

Follow these four steps for any six-digit HEX code:

Worked Examples (Math Checked)

Here are four conversions, with every step shown so you can check the math yourself.

HEX CodePairsDecimal MathRGB Value
#FF5733FF, 57, 33255, 87, 51rgb(255, 87, 51)
#2F7BFF2F, 7B, FF47, 123, 255rgb(47, 123, 255)
#FFFFFFFF, FF, FF255, 255, 255rgb(255, 255, 255)
#00000000, 00, 000, 0, 0rgb(0, 0, 0)

Example 1: #FF5733. FF means 15 times 16 plus 15, which is 240 plus 15, or 255. The pair 57 means 5 times 16 plus 7, which is 80 plus 7, or 87. The pair 33 means 3 times 16 plus 3, which is 48 plus 3, or 51. The result is rgb(255, 87, 51).

Example 2: #2F7BFF. The pair 2F means 2 times 16 plus 15, which is 32 plus 15, or 47. The pair 7B means 7 times 16 plus 11, which is 112 plus 11, or 123. FF is 255. The result is rgb(47, 123, 255), a clear blue.

Example 3: #FFFFFF. All three pairs are FF, and each FF is 255. The result is rgb(255, 255, 255), which is white. All channels at full brightness make white.

Example 4: #000000. All three pairs are 00, and each 00 is 0. The result is rgb(0, 0, 0), which is black. All channels off make black.

Using the Free HEX to RGB Converter

Manual conversion is useful to learn, but you do not need to do it by hand every time. For daily work, use the free HEX to RGB converter on Front Design Tool. Paste or type a HEX code, and it gives you the RGB value instantly, with no sign-up and no cost.

For background on the HEX format, see our guide to what a HEX color code is, or pick a color with the free online color picker.

Common Mistakes to Avoid

HEX to RGB conversion is a small skill, but it removes a lot of friction from everyday design work. Learn the four steps, check your first few conversions against the free converter, and soon you will be able to read either format at a glance.

More articles

Dec 4, 2026

How to Extract Colors From Any Image

Learn how to extract colors from any image, build a palette from them, and check contrast before you use them in a design.

Read More
Dec 4, 2026

How to Choose Brand Colors for Your Business

Learn how to choose brand colors that fit your audience, stand out from competitors, and stay consistent everywhere.

Read More
Dec 4, 2026

Pastel Colors: How to Create Soft Palettes for Websites

Learn what pastel colors are, how to create soft palettes for websites, and how to keep them readable with darker text and neutrals.

Read More