Converters

HEX to RGB Converter

Convert any HEX color code into its exact RGB triplet. Supports both 3-digit and 6-digit HEX, shows a live color preview and lets you copy individual channels or the full rgb() function in one click. Runs entirely in your browser — no uploads, no signup.

HEX input

Try an example:

#267D70
Live preview

RGB output

38
125
112

CSS value

rgb(38, 125, 112)

How to convert HEX to RGB — the exact method

Converting a HEX color to RGB is a straightforward process in three steps:

  1. Remove the leading #.
  2. Split the six digits into three pairs: red, green and blue.
  3. Convert each pair from hexadecimal (base 16) to decimal (base 10).

Example: #267D70 → 26 7D 70 → 26 = 38, 7D = 125, 70 = 112 → rgb(38, 125, 112).

Quick HEX to RGB reference chart

Common colorHEXRGB
Red#FF0000rgb(255, 0, 0)
Green#00FF00rgb(0, 255, 0)
Blue#0000FFrgb(0, 0, 255)
Yellow#FFFF00rgb(255, 255, 0)
Cyan#00FFFFrgb(0, 255, 255)
Magenta#FF00FFrgb(255, 0, 255)
Black#000000rgb(0, 0, 0)
White#FFFFFFrgb(255, 255, 255)
Teal (brand)#267D70rgb(38, 125, 112)

Why HEX and RGB convert exactly

Both HEX and RGB describe the same sRGB color space using 8 bits per channel — 256 possible values per channel, 16,777,216 total colors. A HEX pair FF and the decimal value 255 are the same number in different bases. Conversion is always lossless and reversible.

When to use HEX and when to use RGB

  • HEX — most common in HTML, CSS, design tools and brand guidelines. Compact and easy to read.
  • RGB — easier to work with when you need alpha transparency (rgba()) or when programmatically manipulating color channels.
  • HSL — more intuitive for building palettes and adjusting lightness or saturation. Convert via our HEX to HSL Converter.
  • CMYK — for print. Convert via our CMYK Converter.

FAQ

How do I convert HEX to RGB?
Split the HEX code into three 2-digit pairs (red, green, blue) and convert each from hex to decimal. For #267D70 that gives 38, 125 and 112.
What does #FF0000 mean in RGB?
#FF0000 converts to rgb(255, 0, 0) — pure red.
Does this support 3-digit HEX?
Yes. Codes like #FC0 expand to #FFCC00 before conversion.
Is HEX to RGB conversion lossless?
Yes. Both express the same sRGB color space with 8 bits per channel. The conversion is exact and reversible.
Can I use rgb() in CSS?
Yes. rgb() is supported by every modern browser and works in any CSS color property.
Is this tool free and private?
Yes. Free, no signup, and all processing happens in your browser. Nothing is uploaded.

Related tools

Related articles