Skip to main content

RGB to HEX Converter

Convert RGB colour values to a HEX code and HSL with a live preview

Runs locally in your browser🆓Free — no sign-up🔒100% Private

Frontend developers and web designers frequently work with RGB colour values — they are native to the browser's CSS and Canvas API, returned by colour pickers in JavaScript, and embedded in design frameworks. But many design tools and brand guidelines specify colours as hex codes, which are more compact and easier to memorise and share. Converting RGB triplets back to hex requires knowing the mathematical conversion (divide each value by 255, convert to hex, concatenate), which is faster to automate than to calculate by hand. A developer building a custom colour picker component needs to convert the RGB output from mouse events into a hex string for storage or API submission. A designer preparing a brand colour guide wants to show both the RGB values used in CSS and the hex equivalents used in design files. Anyone colour-matching across tools — comparing a screenshot's RGB values to a brand palette's hex codes, for instance — benefits from quick, accurate conversion. This RGB-to-hex converter eliminates manual arithmetic. Drag three sliders (or enter values directly) to set red, green, and blue channels, and the hex code updates instantly with a live colour preview. Copy the hex value to use immediately in code, CSS, or design tools. All conversion happens locally in your browser.

HEX#7C3AED
HSLhsl(262, 83%, 58%)

How to use RGB to HEX Converter

  1. 1.Use the red, green, and blue sliders to set your colour, or type exact values (0–255) into each field.
  2. 2.Watch the HEX code update instantly as you adjust the sliders — the preview swatch updates live.
  3. 3.See the HSL equivalent appear automatically for CSS custom properties or Tailwind config.
  4. 4.Preview how the colour looks with a large swatch and check it matches your intent.
  5. 5.Click 'Copy' next to the HEX code to copy it directly to your clipboard for immediate use.

Key Features

Three-slider interfaceAdjust red, green, and blue channels with smooth sliders (0–255 range), or type exact values directly.

Real-time HEX outputHEX code updates live as you move sliders, so you see the result before copying.

HSL conversion includedSee the HSL equivalent automatically, useful for CSS custom properties and colour lighten/darken operations.

Instant copy to clipboardClick next to the HEX code to copy it immediately — ready to paste into CSS, JavaScript, or design tools.

Frequently Asked Questions about RGB to HEX Converter

Enter your red, green, and blue values (0–255) using the fields or sliders above, and the tool shows the hex code instantly. Manually, convert each value to two hexadecimal digits and join them: rgb(124, 58, 237) → 7C, 3A, ED → #7C3AED.
Share:
All Tools