RGB Color Generator

Build or generate an RGB color and convert it to HEX and HSL values.

ColorDeveloperBrowser processing

RGB: rgb(79, 70, 229)
HEX: #4F46E5

How to generate an RGB color

  1. Enter an integer from 0 to 255 for red, green, and blue. The preview and values update as you type.
  2. Select Random Color for a new combination, or change one channel at a time to explore variations.
  3. Read the RGB, HEX, and HSL outputs. Use Copy HEX to copy the six-digit code, including the # symbol.
  4. Select Reset to restore the starting purple color.

RGB, HEX, and HSL explained

RGB controls three channels in the sRGB color space. Zero means none of a channel and 255 means its maximum. HEX represents those same integers as three pairs of hexadecimal digits: red, green, then blue. For example, rgb(255, 128, 0) becomes #FF8000.

HSL expresses an sRGB color using hue, saturation, and lightness. This tool rounds HSL values to whole degrees and percentages, so converting that rounded HSL output back to RGB can introduce small differences. The HEX output preserves the entered RGB channels exactly. See the W3C CSS Color specification for color notation details.

Useful examples

  • 0, 0, 0 → #000000: black.
  • 255, 255, 255 → #FFFFFF: white.
  • 255, 0, 0 → #FF0000: red.
  • Equal red, green, and blue values make a neutral gray. Its saturation is 0%; this tool displays its otherwise undefined hue as 0°.

Use the result in CSS

Paste a code into a declaration such as background-color: #FF8000; or color: rgb(255, 128, 0);. The preview shows an opaque color; there is no alpha or transparency input. Screen appearance can vary with display settings, and this tool does not convert to print CMYK values.

Does a generated color have accessible contrast?

A single color cannot establish readable contrast. Check it against the actual foreground or background color used in your design. This generator does not calculate a contrast ratio or certify accessibility.

Why is Copy HEX disabled?

Every channel must contain a whole number between 0 and 255. Empty, fractional, or out-of-range values clear the preview and disable copying until corrected.

Browser processing

This tool calculates the color values in your browser. It writes a HEX code to the clipboard only when you select Copy HEX.

Already have a HEX code? Use the HEX to RGB Converter to decode three-, four-, six-, or eight-digit colors, including alpha.

Related tools