Search calculators

Search all calculators or type # to filter by category

GeneralLive results

RGB ↔ HEX Color Converter

Convert between RGB triplet and HEX color code.

Formula

hex = #RRGGBB

How to use

  1. 1Enter red, green and blue values, each from 0 to 255.
  2. 2Read the HEX code and copy it into your CSS.
  3. 3A blank channel counts as 0; values outside 0 to 255 are clamped.

About this calculator

Screens build every color from three lights: red, green and blue. RGB writes that mix as three numbers, while HEX packs the same information into the short codes web developers paste into CSS. This converter turns an RGB triplet into its HEX code instantly, and knowing the link lets you read and edit colors by hand.

Formula explained

HEX = #RRGGBB. Each channel (0 to 255) becomes a two-digit hexadecimal number, joined in red, green, blue order. Two hex digits cover 0 to 255 exactly, so each channel needs precisely two characters, padded with a leading zero when needed.

Worked example

Red 255 is FF, green 128 is 80 (128 ÷ 16 = 8 remainder 0), blue 0 is 00. Joined, (255, 128, 0) becomes #FF8000, an orange.

Tips & notes

  • Keep HEX codes six digits unless you are deliberately using the three-digit shorthand (#F80 expands to #FF8800).
  • Channel order is always red, green, blue; swapping produces a different color.
  • For accessibility, check contrast rather than raw values: WCAG AA asks for at least 4.5:1 for normal text.

Frequently asked questions