RGB

#336699

rgb(51, 102, 153)

HEX

#336699

Red
Green
Blue

Help Us Improve

—

(—)

RGB to HEX converter

Convert RGB to HEX and hex back to RGB with live preview. Copy CSS-ready codes. Local-first—no signup.

What is an RGB to HEX converter?

An RGB to HEX converter (also searched as RGB to hexadecimal) turns red, green, and blue channel values into a six-digit hex color code used in HTML and CSS—and can reverse the mapping. Use this free local-first converter when you need accurate #rrggbb from rgb() without a signup.

RGB to HEX features

Convert between RGB and hexadecimal with live preview.
  • Channel sliders

    Dial Red, Green, and Blue from 0–255 and see HEX update live.

  • HEX ↔ RGB

    Edit hex or use the color picker to convert back to RGB channels.

  • Paste rgb()

    Drop in rgb(), rgba(), or comma-separated triples for a quick convert.

  • Copy HEX, RGB, HSL

    One-click copy for CSS and design handoffs.

How to convert RGB to HEX

From channels to a copy-ready hex code.
  1. Enter RGB

    Use the Red, Green, and Blue sliders or paste an rgb() string.

  2. Read HEX

    The preview and HEX field show the matching #rrggbb value.

  3. Copy what you need

    Copy HEX, rgb(), or hsl() into your stylesheet or design file.

Tips for RGB and HEX

Faster color handoffs.
  • 01

    Clamp to 0–255

    Out-of-range channel values are rounded into the valid byte range.

  • 02

    Short hex expands

    Three-digit hex like #f63 becomes #ff6633 before conversion.

  • 03

    Sample from a photo

    Grab a hex on Image Color Picker, then paste it here to inspect RGB.

  • 04

    Check contrast next

    After converting, verify text pairs on Colour Contrast Checker.

Great for

When RGB ↔ HEX conversion helps.
  • CSS and HTML

    Turn design-tool RGB into #rrggbb for stylesheets.

  • Design handoffs

    Match Figma or Sketch RGB readouts to web hex codes.

  • Quick checks

    Confirm two formats describe the same color before shipping.

Why convert here

Fast local RGB to hexadecimal conversion.
  • Local-first

    Colors never leave the browser for this tool.

  • Free

    Unlimited conversions with no signup.

  • Bidirectional

    RGB to HEX and HEX to RGB in one place.

  • Live preview

    See the swatch update as you move each channel.

Technical notes

How RGB ↔ HEX works here.
Mapping
Each channel 0–255 → two lowercase hex digits; combined as #rrggbb.
Inputs
Channel sliders, rgb()/rgba()/bare triples, and #rgb / #rrggbb.
Outputs
Lowercase HEX, rgb(), and hsl() strings.
Privacy
Client-side only—no network upload.

Sources & References

Color model references for RGB and hexadecimal notation.
  • “The <hex-color> CSS data type is a notation for describing the hexadecimal color syntax of an sRGB color using its primary color components (red, green, and blue) written as hexadecimal numbers.”
    — MDN Web Docs — <hex-color>

    MDN — <hex-color>: Defines #rrggbb (and short forms) as hexadecimal encoding of RGB channel bytes. developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/hex-color

  • “Hexadecimal (hex) string notation uses a hexadecimal value to represent each component (red, green, and blue) of an RGB color.”
    — MDN Web Docs — CSS color values

    MDN — CSS color values: Explains how hex notation maps to RGB components used by this converter. developer.mozilla.org/en-US/docs/Web/CSS/Guides/Colors/Color_values

  • “The sRGB color space is an RGB color space with defined chromaticities and a defined transfer function.”
    — W3C — CSS Color Module Level 4

    W3C CSS Color Module: Defines the sRGB model behind typical web RGB and hex color values. w3.org/TR/css-color-4/

Frequently Asked Questions

Quick answers about this tool—open a question to read more.