ToolConvoyToolConvoyv2.6
MISC

RGB to HEX — Convert RGB Colors to HEX Codes

Convert RGB color values to HEX codes. Live swatch preview, supports RGB and RGBA — runs entirely in your browser, no upload.

● LOCAL · BROWSER-ONLY0 network requests since page load

RGB to HEX

Convert RGB color values to HEX color codes online. Enter RGB like 255,102,0 and get the hex code.

RGB and HEX are the two dialects of the same colour language, and switching between them is a daily chore for anyone who works at the intersection of design and code. A design handoff delivers colours as RGB triplets — the native format of every screen, every design tool, and every image editing application. Production CSS and configuration files demand HEX codes — the compact, single-string representation that has been the standard since the bgcolor attribute in HTML 3.2. The converter does the arithmetic that every developer eventually learns to do in their head: multiply by 16, divide by 16, repeat for each channel.

The practical friction that the converter eliminates is the mental context switch. Reading a design spec that says rgb(59, 130, 246) while editing a CSS file that needs #3B82F6 requires stopping to do the conversion. Over a day of styling work, that context switch happens dozens of times, and each switch is a small cognitive break in a flow that should be continuous. The converter keeps the flow intact — paste the RGB value, copy the HEX, continue editing.

The alpha channel handling is the feature that matters for modern web development. CSS now supports 8-digit hex colours (#3B82F680 for 50% opacity) in every major browser, but most design tools export alpha as a separate opacity value or as an RGBA declaration. The converter bridges the two representations by accepting an RGBA input and producing an 8-digit hex output when alpha is present, or a 6-digit hex output with the alpha dropped when the destination does not support the extended hex format.

How to use

  1. Enter RGB values

    Type red, green, and blue values (0-255 each) into the three channel inputs, or paste an rgb(59, 130, 246) or rgba(59, 130, 246, 1) string. The HEX output updates live and the swatch preview shows the colour in real time.

  2. Read the HEX output

    The output is a 6-digit HEX code with the # prefix. If alpha is enabled, the output is an 8-digit HEX code (RGBA). The output is copyable as a CSS-ready `#3B82F6` string.

  3. Copy the HEX code

    Copy the HEX colour to your clipboard for use in CSS, design tools, or configuration files. The copy button copies with the # prefix by default; toggle to copy without it if the destination expects bare hex.

Frequently asked

How does RGB map to the 6-digit HEX format?

Each RGB channel (0-255) is converted to a two-digit hex number (00-FF). The red channel becomes the first two hex digits, green the middle two, blue the last two. `rgb(59, 130, 246)` becomes `#3B82F6` because 59=0x3B, 130=0x82, 246=0xF6.

What happens to the alpha channel in the HEX output?

When alpha is toggled on, the output becomes an 8-digit HEX code: the first six digits are the RGB channels, and the last two digits encode the alpha value (0-255 in hex, where FF is fully opaque and 00 is fully transparent). CSS supports 8-digit HEX colours in all modern browsers.

Can I enter RGB values as percentages?

The tool accepts 0-255 integer values and css-style rgb() strings. Percentage values like `rgb(50%, 50%, 50%)` are not supported in the per-channel inputs. Paste the full `rgb(50%, 50%, 50%)` string to convert it — the tool normalises percentages to 0-255 before converting.

Why would I convert RGB to HEX instead of using RGB directly?

Some design tools (Figma, Sketch, Adobe XD) default to HEX output. Some CSS frameworks and older template engines accept only HEX colour strings. Some configuration files (terminal themes, window manager configs) require HEX. Converting your existing RGB values to HEX lets you use the colour in tools that expect the other format.

Is the output always uppercase HEX?

Yes — the output HEX uses uppercase letters A-F, matching the CSS convention and the format used by design tools. CSS is case-insensitive for HEX colours, so lowercase `#3b82f6` works identically. Toggle lowercase output in settings if the destination expects lowercase.

Limitations

  • Clamped to 0-255 per channelValues outside 0-255 are clamped to the nearest valid value. Negative values become 0, values above 255 become 255. For HDR or wide-gamut colour values with channels outside the SDR range, use a colour-management tool.
  • No colour space conversionThe tool assumes the RGB values are in the sRGB colour space. Display P3, Adobe RGB, and ProPhoto RGB values are treated as sRGB, which shifts the rendered colour. For non-sRGB colour spaces, use a colour-management tool that reads the embedded profile.
  • Output is always 6 or 8 hex digitsShort-form 3-digit hex (e.g., #3B8 for #33BB88) is not emitted by default. Toggle short-form output in settings to generate 3-digit hex when all three channel pairs are identical digits (4-digit hex when alpha is also reducible).

Platform notes

macOS
Digital Color Meter shows RGB. The browser tool is the right pick for converting an RGB value from a design brief to the HEX format that CSS or a config file expects.
Linux
For command-line conversion, `printf '#%02X%02X%02X\n' 59 130 246` outputs HEX. The browser tool adds the live swatch preview and the RGBA support.
Web
Runs entirely client-side. Works offline.

Related tools