HEX to RGB Converter / RGB to HEX Converter

Convert color codes between HEX and RGB instantly. Supports alpha (RGBA, 8-digit HEX), CSS4 syntax, and one-click copy. Conversion runs entirely in your browser โ€” nothing is uploaded.

Color preview#FF5733

Accepts 3, 4, 6, or 8 hex digits, with or without #. Examples: #F53, #FF5733, #FF573380.

Output format

Accepts rgb(), rgba(), CSS4 space syntax, or comma-separated values.

Or enter channels individually

Private โ€” your color values stay on this device.
  • Type or paste a HEX value (with or without #) on the left โ€” the RGB output updates as you type.
  • Or type an RGB value on the right (using rgb(), rgba(), CSS4 syntax, or comma-separated channels) โ€” the HEX output updates instantly.
  • You can also enter individual R, G, B, and A channels in the numeric fields.
  • Use the format toggles to switch the # prefix, HEX case, CSS4 space syntax, or always-include-alpha output.
  • Click the Copy button next to either output to copy the formatted value to your clipboard.

Worked examples

  1. #FF5733 โ†’ rgb(255, 87, 51)

    Split the 6 hex digits into three pairs: FF, 57, 33. Convert each pair from base 16 to base 10: FF = 15ร—16 + 15 = 255, 57 = 5ร—16 + 7 = 87, 33 = 3ร—16 + 3 = 51. Result: rgb(255, 87, 51).

  2. #F53 โ†’ #FF5533 โ†’ rgb(255, 85, 51)

    Three-digit shorthand doubles each digit: Fโ†’FF, 5โ†’55, 3โ†’33. The expanded code is #FF5533, which converts to rgb(255, 85, 51).

  3. rgb(64, 128, 192) โ†’ #4080C0

    Convert each channel from base 10 to base 16, padding to two digits: 64 = 40, 128 = 80, 192 = C0. Concatenate the pairs: #4080C0.

HEX โ†” RGB reference

Common named colors and their HEX and RGB equivalents.

Swatch Color HEX RGB
Black #000000 rgb(0, 0, 0)
White #FFFFFF rgb(255, 255, 255)
Red #FF0000 rgb(255, 0, 0)
Green #008000 rgb(0, 128, 0)
Blue #0000FF rgb(0, 0, 255)
Tomato #FF6347 rgb(255, 99, 71)
Coral #FF7F50 rgb(255, 127, 80)
Salmon #FA8072 rgb(250, 128, 114)
DodgerBlue #1E90FF rgb(30, 144, 255)
DeepSkyBlue #00BFFF rgb(0, 191, 255)
Gold #FFD700 rgb(255, 215, 0)
Orange #FFA500 rgb(255, 165, 0)
HotPink #FF69B4 rgb(255, 105, 180)
SlateGray #708090 rgb(112, 128, 144)
Teal #008080 rgb(0, 128, 128)
Indigo #4B0082 rgb(75, 0, 130)
Violet #EE82EE rgb(238, 130, 238)
LimeGreen #32CD32 rgb(50, 205, 50)
Crimson #DC143C rgb(220, 20, 60)
Navy #000080 rgb(0, 0, 128)
What is a HEX color code?

A HEX color code is a hexadecimal representation of a color used in web design and CSS. It encodes the red, green, and blue components, where each pair of hex digits represents one channel from 0 to 255. For example, #FF5733 means R=255, G=87, B=51. An optional 7th and 8th digit (#RRGGBBAA) encodes the alpha channel.

What is RGB?

RGB stands for Red, Green, Blue โ€” an additive color model where colors are produced by combining intensities of red, green, and blue light. Each channel ranges from 0 to 255. In CSS, RGB is written as rgb(255, 87, 51) or rgba(255, 87, 51, 0.5) when an alpha channel is included.

How do I convert HEX to RGB by hand?

Split the 6-digit hex into three pairs (e.g. #FF5733 โ†’ FF, 57, 33), then convert each pair from base 16 to base 10: parseInt("FF", 16) = 255, parseInt("57", 16) = 87, parseInt("33", 16) = 51. The result is rgb(255, 87, 51).

What is the difference between #FFF and #FFFFFF?

#FFF is the 3-digit shorthand where each digit is doubled to expand to the full value: Fโ†’FF, Fโ†’FF, Fโ†’FF. So #FFF and #FFFFFF are identical โ€” both pure white (255, 255, 255). Similarly, #F53 expands to #FF5533.

What does the alpha channel do in #RRGGBBAA?

The alpha channel controls transparency. In 8-digit HEX, the last two digits represent alpha: 00 is fully transparent, FF is fully opaque, and 80 is roughly 50% transparent. For example, #FF573380 is the color #FF5733 at about 50% opacity.

Is RGBA the same as RGB with opacity?

Yes. RGBA extends RGB with an alpha channel that controls opacity. rgba(255, 87, 51, 0.5) is the same color as rgb(255, 87, 51) at 50% opacity. In the CSS Color Level 4 spec, you can also write rgb(255 87 51 / 0.5) โ€” modern rgb() accepts alpha natively.

Is my color data stored or sent anywhere?

No. The converter runs entirely in your browser. Color values, inputs, and conversion results are never sent to a server, logged, or shared. There are no third-party trackers on your input.

Why do some browsers reject the rgb(255 87 51) syntax?

Space-separated rgb(255 87 51) and rgb(255 87 51 / 0.5) are part of the CSS Color Level 4 spec. Very old browsers only support the legacy comma-separated rgb(255, 87, 51) form. Use the CSS4 toggle to switch between the two output formats.

What's the RGB of pure white, black, and red?

Pure white: #FFFFFF = rgb(255, 255, 255). Pure black: #000000 = rgb(0, 0, 0). Pure red: #FF0000 = rgb(255, 0, 0).