HEX ↔ RGB Color Converter

Type HEX or RGB. #FF5733 stays #FF5733. #0F0 becomes #00FF00. 255, 87, 51 become #FF5733. An sRGB convert, not a color picker.

Enter #RRGGBB or R, G, B channels (0–255), click Calculate, and copy CSS-ready output.

This converts #RRGGBB ↔ rgb(r,g,b), channels 0-255. No HSL and no picker. Another base sits on binary / hex / decimal.

Input data

Convert from:

Choose HEX or RGB as the source, enter values, then click Calculate.

Results

Enter a color, choose the direction, and click Calculate.

What is HEX and RGB color coding?

RGB is an additive color model used on screens. A color is mixed from three light channels: red (R), green (G), and blue (B). Higher channel values mean stronger light in that channel.

In typical CSS notation each channel is an integer from 0 to 255 (8 bits per channel). Zero means no light in that channel; 255 means full intensity.

  • rgb(255, 0, 0) — red
  • rgb(0, 255, 0) — green
  • rgb(0, 0, 255) — blue
  • rgb(0, 0, 0) — black (no light)
  • rgb(255, 255, 255) — white (all channels full)

HEX is another notation for the same values. Instead of three decimal numbers you use a hexadecimal string in the form #RRGGBB:

  • RR — red
  • GG — green
  • BB — blue

Each pair is one 0–255 number written in hex (digits 0–9 and letters A–F). So #FF0000 is the same color as rgb(255, 0, 0).

How do I convert HEX to RGB?

Manual HEX → RGB conversion works like this:

  1. Remove the leading # if present (e.g. #4CAF504CAF50).
  2. Split the six characters into three pairs: RR, GG, BB.
  3. Convert each pair from hexadecimal to decimal.
  4. Write the result as rgb(r, g, b).

A useful rule for one hex pair:

decimal value = 16 × first digit + second digit

Where A=10, B=11, C=12, D=13, E=14, F=15. Example: 4C16 × 4 + 12 = 76.

The other way (RGB → HEX): convert each 0–255 channel to a two-digit hex value and join them as #RRGGBB. This calculator performs both directions when you click Calculate.

Example of converting HEX to RGB

Take the color #4CAF50.

StepValueCalculation
Input#4CAF50drop #4CAF50
Split4C · AF · 50RR · GG · BB
R4C16 × 4 + 12 = 76
GAF16 × 10 + 15 = 175
B5016 × 5 + 0 = 80
Resultrgb(76, 175, 80)

The reverse is the same values: 76, 175, 80#4CAF50.

How to use this HEX ↔ RGB color converter

  1. Choose the direction with Convert from:HEX or RGB.
  2. If HEX is the source, enter a color (#RRGGBB, RRGGBB, or shorthand #RGB). The R, G, B fields are then read-only outputs.
  3. If RGB is the source, enter three integers from 0 to 255. The HEX field is then read-only.
  4. Click Calculate. Results appear only after submit — there is no live recalculation while typing.
  5. In the results panel you get normalized HEX (uppercase with #), rgb(r, g, b), separate channels, a color preview, a CSS snippet, and Copy buttons.

Switching the source clears the previous result — click Calculate again after changing direction.

What is HEX shorthand notation?

Shorthand #RGB works only when both digits of each full pair are identical. Then one character per channel is enough:

  • #FFF = #FFFFFF (white)
  • #000 = #000000 (black)
  • #F00 = #FF0000 (red)

Expansion duplicates each character: FFF, 000.

This calculator accepts HEX shorthand and expands it to full #RRGGBB before conversion. When you enter shorthand, the results area also shows a short expansion note.

Manual conversion cheat sheet

  • HEX → RGB: drop # → three pairs → each pair to decimal → rgb(r, g, b)
  • RGB → HEX: each channel to 2-digit hex → join → add #
  • Hex digits: 0–9, A=10 … F=15
  • Pair formula: 16 × first + second

Common colors — HEX and RGB

ColorHEXRGB
Black#000000rgb(0, 0, 0)
White#FFFFFFrgb(255, 255, 255)
Red#FF0000rgb(255, 0, 0)
Green#00FF00rgb(0, 255, 0)
Blue#0000FFrgb(0, 0, 255)
Yellow#FFFF00rgb(255, 255, 0)
Material green#4CAF50rgb(76, 175, 80)

How it works

HEX ↔ RGB Color Converter in this calculator converts a colour notation. #FF5733 stays #FF5733. #0F0 becomes #00FF00. 255, 87, and 51 become #FF5733. The calculator is not a color picker and has no HSL.

Field hex-val is HEX text. Fields rgb-r, rgb-g, rgb-b are channels 0-255. Fill keeps hex-rgb-source hex or rgb. #RGB expands: #0F0 becomes #00FF00. The extras result is uppercase #RRGGBB.

#FF5733 does not come from a Figma eyedropper. #00FF00 is not a system palette. The third card starts from RGB, not a picker. You type the values. There is no alpha.

Binary / hex / decimal next door reads FF as 255. ASCII reads a character. Here #FF5733 stays #FF5733, the convert alone.

Type #FF5733, source hex, then Calculate. The result is #FF5733. #0F0 becomes #00FF00. 255, 87, 51 with source rgb also become #FF5733.

#FF5733 stays #FF5733. #0F0 becomes #00FF00. 255, 87, 51 become #FF5733. Another HEX changes the result.

Formula

#RRGGBB ↔ rgb(r,g,b); #RGB expands. Channels 0-255, not a picker.

How to use

  1. Type #FF5733 and leave the source on hex.
  2. Click Calculate. The result is #FF5733.
  3. #0F0 becomes #00FF00. 255, 87, 51 with rgb become #FF5733.
  4. A convert, not a color picker.
  5. The next card reads FF as a number, not a colour.

#FF5733 stays #FF5733

HEX ↔ RGB, channels 0-255. #FF5733 stays #FF5733. Not a picker.

HEX
The hex-val field. #FF5733 stays #FF5733. Not an eyedropper.
RGB
Channels 0-255. 255, 87, 51 become #FF5733. Not a picker.
Color
An sRGB notation. #0F0 leaves #00FF00. Not HSL.

Examples

Example 1

  • #FF5733
  • source hex

#FF5733

What HEX from #FF5733? #FF5733. A convert, not a picker.

Example 2

  • #0F0
  • source hex

#00FF00

What HEX from #0F0? #00FF00. Short #RGB expands.

Example 3

  • R 255
  • G 87
  • B 51
  • source rgb

#FF5733

What HEX from rgb(255, 87, 51)? #FF5733.

Related calculators

Common questions

What result from #FF5733?

#FF5733. The same HEX. A convert, not a picker.

What about #0F0?

#00FF00. Short #RGB expands to #RRGGBB.

What about 255, 87, 51?

#FF5733. Source rgb in the fill.

Is this a color picker?

No. No eyedropper and no colour wheel. Fields only.

Do HSL or alpha work?

No. Only sRGB 0-255 and #RRGGBB or #RGB.

Why hex-rgb-source?

hex reads hex-val. rgb reads three channels. It is in the fill.

How is this different from bin / hex / dec?

That card turns FF into 255 as a number. Here #FF5733 stays a colour.

Does lowercase #ff5733 work?

Yes, the calculator raises it to #FF5733. Extras take uppercase.

Does blank HEX count?

Not on source hex. On rgb you need three channels.

Knowledge sources

The calculator counts bits, bytes or throughput from your numbers. Below are SI and bit definitions (NIST).

Page updated in 2026.