DocumentsImagesMediaPDF Tools

HEX to RGB

Convert any HEX code to its RGB values instantly, in your browser.

196
R
85
G
45
B
Processed in your browser

From HEX code to RGB values in one click

Supports all HEX formats

#RGB, #RRGGBB, #RGBA, #RRGGBBAA, and CSS names. Automatic format detection.

Private

Conversion happens in your browser. No data ever leaves your device.

CSS-ready result

Copy directly in rgb() or rgba() format to paste into your stylesheet.

Instant

Real-time result as you type the HEX code.

Three steps, no hassle

1

Enter the HEX code

Type the hexadecimal color code: long format (#FF5733), short (#F53), or with alpha (#FF573380). You can also type a CSS color name (red, tomato, steelblue) and it will be converted automatically.

2

Get the RGB values

The converter instantly calculates the R (red), G (green), and B (blue) channels in the 0-255 range. If the HEX includes an alpha channel, you also get the opacity value for RGBA.

3

Copy the result

Copy the result in rgb(255, 87, 51) or rgba(255, 87, 51, 0.5) format, ready to paste into your CSS, JavaScript code, or design tool.

Got questions?

HEX refers to the hexadecimal system, a base-16 numbering system that uses digits 0-9 and letters A-F (where A=10, B=11, C=12, D=13, E=14, F=15). A HEX color code like #FF5733 represents three hexadecimal pairs: FF (red = 255), 57 (green = 87), 33 (blue = 51). Each hex pair can represent 256 values (0x00 = 0 to 0xFF = 255), allowing 256³ = 16,777,216 distinct colors in the sRGB space.

A 6-character HEX code (#RRGGBB) uses 2 characters per color channel (red, green, blue). Each hexadecimal character represents 4 bits, so 2 characters represent 8 bits = 1 byte, capable of storing 256 values (0-255). With 8 bits per channel and 3 channels (RGB), you get a color depth of 24 bits, the standard for true color images since the era of CRT monitors in the 1990s.

Short HEX is a valid CSS abbreviation where each character is automatically doubled: #FFF equals #FFFFFF (white), #000 equals #000000 (black), #F53 equals #FF5533. It only works when both digits of each pair are identical. It was introduced in CSS1 (1996) to reduce code size. Not all color parsers support short HEX outside of CSS, so in JavaScript or design tools it may be necessary to expand it to the full 6-character format.

The 8-character HEX (#RRGGBBAA) adds a fourth hexadecimal pair for the alpha (opacity) channel, where #RRGGBB00 is fully transparent and #RRGGBBFF is fully opaque. For example, #FF573380 equals rgba(255, 87, 51, 0.502). This format was standardized in CSS Color Level 4 and is supported by all modern browsers since 2017. The 4-character short version (#RGBA) also exists: #F538 equals #FF553388.

6-character HEX codes can represent 16,777,216 colors, which is exactly the 24-bit sRGB color space (8 bits per channel). This covers the entire sRGB gamut but does not include out-of-gamut colors, such as display-p3 colors on modern high-dynamic-range screens (iPhone since 2016, MacBook Pro since 2016). For wide-gamut colors in CSS, the color(display-p3 r g b) function from CSS Color Level 4 is used, which has no representation in standard HEX.

History of hexadecimal notation in web colors

The hexadecimal system as color notation for the web was popularized by the first graphical browsers. Mosaic (NCSA, 1993), the first widely used graphical browser, introduced the bgcolor attribute in HTML that accepted English color names (red, blue) or hexadecimal codes in #RRGGBB format. Netscape Navigator (1994) expanded this convention and added support for the 140 named colors that are today part of the CSS standard, many derived from the X11 colors defined by the MIT X Consortium in 1987 for the X Window System windowing system used on Unix.

X11 colors are the historical source of names like 'alice blue', 'cornflower blue', 'dark salmon', or 'papaya whip'. They were originally defined in the rgb.txt file of the X11 server between 1987 and 1989, with specific RGB values tied to the monitor hardware of the time. When Netscape adopted these names for HTML, it created historical inconsistencies: 'green' in HTML/CSS is #008000 (not the pure green #00FF00, which is called 'lime'), and 'gray' has multiple spelling variants ('grey' and 'gray' are synonyms in CSS). CSS Color Level 4 has formalized all these historical names, also adding 'rebeccapurple' (#663399), in honor of Rebecca Meyer, daughter of CSS expert Eric Meyer, who passed away in 2014.

The CSS Color Level 1 specification (W3C, 1996) defined 16 basic named colors inherited from HTML. CSS Color Level 2 (2011) added 'orange'. CSS Color Level 3 (2011) standardized the 147 X11 colors, including 'rebeccapurple' in 2014. CSS Color Level 4 (in recommendation process) adds modern functions like oklch(), lab(), lch(), and color() for wide-gamut spaces. In parallel, the W3C SVG 1.1 specification (2003) defined its own 147 named colors, aligned with X11 but slightly different in some numerical values, causing historical confusion between browser implementations until standardization in CSS Color Level 3.