HEX rau RGB converter

Hloov txhua HEX xim rau RGB — tam sim thiab dawb

#FF5733

Nqa ib qho xim txiaj — peb pom tus qauv rau koj.

Kev tshwm sim RGB
Liab
255
Ntsuab
87
Xiav
51

Tus xim no hauv txhua hom

Tus qauv CMYK: Coated FOGRA39 (Photoshop qhov kev teeb tsa ib txwm rau Tebchaws Europe)

A HEX code packs three 8-bit numbers into six hexadecimal digits. Converting HEX to RGB means splitting those digits into pairs and reading each pair as a decimal number between 0 and 255 — exactly the values CSS, Figma and image editors expect.

Yuav ua li cas HEX rau RGB hloov ua haujlwm

  1. Drop the leading # and, if the code has only three digits, double each one: #f53 becomes #ff5533.
  2. Split the six digits into three pairs — RR, GG and BB.
  3. Read each pair as a base-16 number and convert it to base 10: FF becomes 255, 57 becomes 87, 33 becomes 51.
  4. Write the three results as rgb(R, G, B).

Qhia ua piv txwv

HEX #FF5733=RGB rgb(255, 87, 51)

This conversion is exact. HEX and RGB describe the same sRGB values in a different notation, so nothing is rounded or lost in either direction.

HEX thiab RGB piav

Dab tsi yog HEX?

A HEX code is a six-digit hexadecimal number that stores the red, green and blue channel of a color behind a leading #. Each pair of digits covers one channel, from 00 (none) to FF (full), which gives the same 16.7 million colors as RGB in a much shorter notation. HEX is the default in CSS, design tools and brand guidelines.

Syntax:
#RRGGBB
Range:
00–FF per channel
Zoo tshaj rau:
CSS, design handoff, brand guidelines

Dab tsi yog RGB?

RGB piav txog xim ua peb lub channel ntawm teeb — liab, ntsuab thiab xiav — txhua tus los ntawm 0 txog 255. Nws cia raws li cov zaub ua haujlwm tiag: tag nrho peb ntawm 255 yog dawb, tag nrho ntawm 0 yog dub. RGB yog qhov kev xaiv thaum twg koj xav xam nrog xim, thiab rgba() ntxiv kev pom qhov muag (transparency) ntxiv.

Syntax:
rgb(R, G, B)
Range:
0–255 per channel
Zoo tshaj rau:
code, canvas, transparency with rgba()

HEX rau RGB daim ntawv reference

Cov xim CSS feem ntau, hloov los ntawm HEX rau RGB.

XimHEXRGB
black#000000rgb(0, 0, 0)
white#FFFFFFrgb(255, 255, 255)
red#FF0000rgb(255, 0, 0)
lime#00FF00rgb(0, 255, 0)
blue#0000FFrgb(0, 0, 255)
yellow#FFFF00rgb(255, 255, 0)
orange#FFA500rgb(255, 165, 0)
teal#008080rgb(0, 128, 128)
purple#800080rgb(128, 0, 128)
gray#808080rgb(128, 128, 128)

Cov lus nug feem ntau

Drop the leading # and, if the code has only three digits, double each one: #f53 becomes #ff5533. Split the six digits into three pairs — RR, GG and BB. Read each pair as a base-16 number and convert it to base 10: FF becomes 255, 57 becomes 87, 33 becomes 51. Write the three results as rgb(R, G, B).

This conversion is exact. HEX and RGB describe the same sRGB values in a different notation, so nothing is rounded or lost in either direction.

RGB piav txog xim ua peb lub channel ntawm teeb — liab, ntsuab thiab xiav — txhua tus los ntawm 0 txog 255. Nws cia raws li cov zaub ua haujlwm tiag: tag nrho peb ntawm 255 yog dawb, tag nrho ntawm 0 yog dub. RGB yog qhov kev xaiv thaum twg koj xav xam nrog xim, thiab rgba() ntxiv kev pom qhov muag (transparency) ntxiv.

Tau. Qhov khawm swap uas nyob ze rau qhov input coj koj mus rau RGB mus HEX converter, uas ua haujlwm tib yam. Ob qho txhia txoj kev siv tib qho formula, tsuas yog siv qhov hloov rov qab.

Siv RGB thaum koj xav ua haujlwm nrog cov lej — animate ib qho channel, mix xim hauv code, lossis ntxiv transparency nrog rgba(). HEX nyob rau hauv qhov luv thiab yooj yim nyeem rau static CSS.