Skip to content

HEX to RGB Converter

In-browser only HEX ⇄ RGB Alpha & CSS4
RGBA channels
Color preview#FF5733
HEX#FF5733
RGBrgb(255, 87, 51)

Overview

Convert color codes both ways

Convert color codes between HEX and RGB in both directions. Supports alpha (RGBA and 8-digit HEX), CSS4 space syntax, and one-click copy. Everything runs in your browser.

Getting started

How to Convert a Color

  1. 1
    Enter a HEX code

    Type or paste a HEX value into the HEX field, with or without the # prefix. The RGB value and channel inputs update as you type.

  2. 2
    Or enter an RGB value

    Type an RGB value into the RGB field using rgb(), rgba(), CSS4 space syntax, or bare comma-separated channels. The HEX value updates instantly.

  3. 3
    Fine-tune with channels

    Adjust the R, G, and B channel fields (0–255) or the A field (0–1) to tweak the color directly. Both HEX and RGB outputs follow along.

  4. 4
    Set the output format

    Toggle uppercase HEX or CSS4 space syntax to match your codebase, then click the copy button next to the value you need.

Reference

Common HEX ↔ RGB Values

Common HEX ↔ RGB Values
ColorHEXRGB
Black#000000rgb(0, 0, 0)
White#FFFFFFrgb(255, 255, 255)
Red#FF0000rgb(255, 0, 0)
Green#008000rgb(0, 128, 0)
Blue#0000FFrgb(0, 0, 255)
Tomato#FF6347rgb(255, 99, 71)
DodgerBlue#1E90FFrgb(30, 144, 255)
Gold#FFD700rgb(255, 215, 0)
HotPink#FF69B4rgb(255, 105, 180)
SlateGray#708090rgb(112, 128, 144)
Teal#008080rgb(0, 128, 128)
Crimson#DC143Crgb(220, 20, 60)

Good to know

Tips and Common Mistakes

  • Shorthand HEX doubles each digit

    #F53 expands to #FF5533, not #F05030. Each of the three digits is repeated, so #FFF and #FFFFFF are the same white.

  • Alpha lives in the last pair

    In 8-digit HEX (#RRGGBBAA) the final two digits set opacity: 00 is fully transparent, FF is fully opaque, 80 is roughly 50%.

  • CSS4 uses spaces, not commas

    Modern rgb(255 87 51 / 0.5) separates channels with spaces and the alpha with a slash. Older browsers need the legacy rgb(255, 87, 51) form.

  • RGB channels stop at 255

    Each channel is a whole number from 0 to 255. Values above 255 or with decimals are out of range and will not convert.

Frequently Asked Questions

What is a HEX color code?
A HEX color code is a hexadecimal representation of a color used in web design and CSS. Each pair of hex digits encodes one channel — red, green, and blue — 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 (#FF5733 → FF, 57, 33), then convert each pair from base 16 to base 10: FF = 255, 57 = 87, 33 = 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. So #FFF and #FFFFFF are identical — both pure white. Likewise #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.
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 form. Use the CSS4 toggle to switch between the two output formats.
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.