Design & MediaLive🔒 Private

RGB to Hex

Convert RGB color values to HEX codes instantly. Free online RGB to Hex converter — supports rgba and fractional values. No signup, browser-based.

How it works

The RGB to Hex Converter translates RGB or RGBA color values to their hexadecimal CSS representation — converting rgb(255, 87, 51) to #FF5733. It handles integer RGB (0–255), decimal RGB (0.0–1.0), and RGBA values with an alpha channel.

Designers work in RGB because it maps to how screens produce light and how CSS handles opacity. Developers often prefer hex because it's more compact in stylesheets and HTML attributes. When copying a color from Figma (which uses RGB) to a CSS file (which often uses hex), this converter bridges the gap instantly.

How to use it: enter R, G, B values (0–255 range) and optionally an alpha value (0–255 or 0.0–1.0). The hex equivalent appears instantly with a color preview. The output includes the 6-digit hex string, the 3-digit shorthand when possible, and the 8-digit hex with alpha when an alpha value is provided.

Shorthand detection: if each RGB component after conversion produces a doubled pair (e.g., R=17 → 11, G=34 → 22, B=51 → 33), the tool also shows the 3-digit shorthand (#123) alongside the full 6-digit hex.

Figma workflow: Figma's color picker shows RGB values in 0–255 range. Copy the values, paste them here, and get the hex for your CSS in one step without mental arithmetic.

Frequently Asked Questions

What happens if I enter a value above 255?
RGB channels are clamped to 0–255. Values above 255 are treated as 255, values below 0 are treated as 0. A warning is shown for out-of-range input.
Can I enter decimal RGB values like 0.5?
Toggle to 'Decimal mode' (0.0–1.0 range per channel). This is the format used by some design tools and CSS color functions like color(srgb 1 0.5 0).
Does the tool produce uppercase or lowercase hex?
Both — toggle your preference. Uppercase (#FF5733) is conventional in HTML attributes and older CSS. Lowercase (#ff5733) is preferred in modern CSS style guides. The rendered color is identical.
Can I enter an RGB value with an alpha channel?
Yes. Enter the alpha value (0–255 or 0.0–1.0) and the output is 8-digit hex (#RRGGBBAA) alongside the rgba() CSS function.