Skip to main content

RGB to HEX Converter

Converts among RGB (0-255 each), 3-digit or 6-digit HEX, and HSL (H 0-360, S and L 0-100); editing any one format updates the other two in real time. The HEX output case (uppercase vs lowercase) and the leading hash are independently toggleable. A swatch previews the current color, and clicking any of the three output values copies it to the clipboard.

Runs entirely in your browser

This tool sends nothing over the network. Everything you enter is processed on your device and never reaches our servers.

Color
Web Development
CSS
Graphic Design
Loading the tool
Reference

Documentation

An RGB to HEX converter translates a color between RGB, HEX, and HSL formats. Entering a value in any one of the three color systems updates the other two automatically in real time.

RGB values run from 0 to 255 per channel (red, green, blue). A HEX code is entered with or without the leading hash, in either 3-digit shorthand (#F00) or 6-digit form (#FF5733). HSL values are hue from 0 to 360, and saturation and lightness each from 0 to 100.

The conversion uses standard color math. RGB to HEX maps each 0 to 255 channel to a two-digit hexadecimal pair, then concatenates them; HEX to RGB reverses that mapping. RGB to HSL normalizes the channels to 0 to 1, finds the minimum and maximum, and derives hue, saturation, and lightness from those values; HSL to RGB applies the inverse transform, so a change to any single field stays consistent across all three representations.

RGB and HEX describe the same channel values in two notations, so converting between them is exact in either direction with nothing to round. HSL is derived from ratios of the RGB channels (the minimum, the maximum, and the difference between them), so a value can shift by a fraction of a percent on a round trip through HSL and back, which rarely matters visually but explains why re-entering a converted HSL value does not always reproduce the original RGB integers exactly.

A preview swatch confirms the color visually alongside the numeric values. Any of the three output values can be copied directly to the clipboard for pasting into CSS, design tools, or documentation. Settings independently toggles uppercase versus lowercase HEX output and whether the leading # prefix appears in it.

Color conversion is a frequent task across many creative and technical disciplines. This converter applies whenever a color value needs to move from one system to another quickly and accurately.

  • Web Development: Convert RGB values from a design mockup into HEX codes for CSS stylesheets. Paste the copied HEX value directly into a code editor to match the exact brand color specified by the design team.
  • Graphic Design: Translate HEX codes from a brand style guide into RGB values for use in Photoshop, Illustrator, or Figma. Ensure consistent color reproduction across all design deliverables.
  • UI and UX Design: Experiment with HSL values to adjust hue, saturation, and lightness independently. Find complementary or contrasting colors by shifting the hue while keeping saturation and lightness constant.
  • Accessibility Testing: Convert colors between formats to compare values against WCAG contrast ratio requirements. Verify that text and background color combinations meet accessibility standards by checking their numeric values.
  • Email Marketing: Look up HEX codes for inline CSS in HTML email templates where only HEX color values are reliably supported by most email clients.
  • Presentation Design: Match a specific color from a website or application by entering the RGB values and obtaining the HEX code for use in PowerPoint, Keynote, or Google Slides custom color pickers.
  • Game Development: Convert between color formats when working with engines that accept different color input types. Translate HEX values from asset libraries into RGB tuples for shader code.
  • Print Preparation: Identify the RGB equivalent of screen colors before converting to CMYK in professional print workflows. Use the preview swatch to visually confirm color accuracy before sending files to print.
Inputs, outputs, and what the RGB to HEX Converter computes

What the RGB to HEX Converter asks for and what it returns, as a plain list. Defaults, units, and ranges are the ones the form loads with.

Inputs

  • Red (0–255) (numeric input) · default: 0 · range: 0 to 255
  • Green (0–255) (numeric input) · default: 0 · range: 0 to 255
  • Blue (0–255) (numeric input) · default: 0 · range: 0 to 255
  • HEX Code (text input) · default: #000000
  • Hue (0–360) (numeric input) · default: 0 · range: 0 to 360
  • Saturation (0–100%) (numeric input) · default: 0 · range: 0 to 100
  • Lightness (0–100%) (numeric input) · default: 0 · range: 0 to 100
  • Uppercase HEX output · default: on
  • Include # prefix in HEX · default: on

Controls

Convert · Reset