Hex Color to RGB Converter

Paste a 6-digit #RRGGBB hex color and get the equivalent rgb(r, g, b) CSS value, plus a live swatch preview and the individual R/G/B readouts, a deliberately opaque-only counterpart to the Hex Color to RGBA Converter for colors that never had a transparency component. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-26

Overview

Introduction

Most hex colors used in design and CSS are the plain, fully opaque 6-digit #RRGGBB form, and plenty of code, canvas APIs, and design tools want that expressed as separate red, green, and blue integers rather than a packed hex string.

This tool takes a 6-digit hex color and converts it straight to an rgb(r, g, b) CSS value, with no alpha channel involved at any point.

What Is Hex Color to RGB Converter?

A hex-to-RGB converter that decodes a #RRGGBB hex color's three byte pairs into decimal red, green, and blue values (0-255 each), then formats them as the rgb(r, g, b) syntax CSS and most graphics tools accept.

It's intentionally scoped to opaque colors only; the 8-digit #RRGGBBAA form with an embedded alpha byte belongs to its sibling tool, Hex Color to RGBA Converter.

How Hex Color to RGB Converter Works

The input's optional # prefix is stripped, and the remaining text is validated as exactly 6 hex digits, if it's 8 digits instead, that means an alpha byte is present and the tool errors out rather than silently discarding it.

Each of the three valid hex byte pairs (red, green, blue) is parsed as base-16 and formatted into the rgb(r, g, b) string alongside the raw R/G/B numbers.

When To Use Hex Color to RGB Converter

Use this when you have a plain, fully opaque hex color from a design tool, brand guide, or CSS file and need its rgb() equivalent for a stylesheet, canvas fill, or an API expecting separate r/g/b numbers.

If your color has (or needs) a transparency component, use Hex Color to RGBA Converter instead; this tool deliberately won't handle alpha.

Features

Advantages

  • Simple, single-purpose conversion: strictly 6-digit hex in, plain rgb() out, no alpha bookkeeping to think about.
  • Clear, actionable error (pointing to the right tool) if you accidentally paste an 8-digit hex color that has an alpha byte.
  • Live swatch preview lets you visually confirm the parsed color before copying the result.

Limitations

  • Only accepts the 6-digit hex form; 3-digit CSS shorthand (like #F00) and the 8-digit #RRGGBBAA form are both rejected outright rather than being auto-expanded or auto-truncated.
  • Produces only the modern comma-based rgb(r, g, b) syntax; it doesn't offer the newer space-separated CSS Color 4 function notation.

Examples

Converting an opaque brand blue

Input

#3366FF

Output

rgb(51, 102, 255)

33 -> 51, 66 -> 102, FF -> 255, formatted as an rgb() triple.

Converting pure red without the # prefix

Input

FF0000

Output

rgb(255, 0, 0)

The # prefix is optional; FF -> 255 for red, and the remaining two bytes are both 0.

Best Practices & Notes

Best Practices

  • Use this tool specifically when you know your color is fully opaque; if there's any chance it carries transparency, use Hex Color to RGBA Converter so the alpha byte isn't lost.
  • Double-check the swatch preview matches what you expect before copying the rgb() value into production CSS.

Developer Notes

Parsing reuses the category's shared `parseHexColor` helper, which recognizes both the 6-digit and 8-digit forms; this tool explicitly checks for the presence of `alphaByte` on the parsed result and rejects the input with a pointer to Hex Color to RGBA Converter rather than silently discarding the alpha byte the helper decoded.

Hex Color to RGB Converter Use Cases

  • Converting a brand hex color into rgb() for a CSS variable or design token
  • Feeding a canvas or SVG fill attribute with individual R/G/B values decoded from hex
  • Translating a design tool's opaque hex export into the rgb() format a charting library expects

Common Mistakes

  • Pasting an 8-digit #RRGGBBAA color expecting the alpha byte to just be ignored; this tool rejects it instead so you don't lose transparency information silently.
  • Trying 3-digit CSS shorthand hex (like #F00); it must be expanded to the full 6-digit form first.

Tips

  • If you get the "8 hex digits" rejection, that's your color telling you it has an alpha channel, head to Hex Color to RGBA Converter instead.
  • Use RGB to Hex Color Converter to go the other direction and pack R/G/B numbers back into a hex string.

References

Frequently Asked Questions