Skip to content
uencoder
TASK

Convert RGB colors to HEX (and back)

Translate color values between rgb() and #rrggbb notation, with alpha-channel handling for CSS work.

  1. 1
    Color Converter →

    Paste rgb(90, 200, 250) to get #5AC8FA, or paste a hex value to get its rgb() form. 8-digit hex with alpha (#5AC8FAFF) converts to rgba() notation.

  2. 2

    Details worth knowing: HEX and rgb() are the same color space (sRGB) in different syntax — conversion is lossless; 3-digit hex (#F0A) is shorthand for #FF00AA; CSS colors work — named colors and hsl() inputs are converted too. When precision matters (design tokens), prefer 6-digit hex or rgb() over 3-digit shorthand.

  3. 3
    Color Contrast Checker →

    After converting, check the color against your background: WCAG contrast ratios determine whether text passes accessibility thresholds (4.5:1 for body text, 3:1 for large text).

Frequently asked questions

Is HEX more accurate than RGB?
No — they express identical sRGB values. #5AC8FA and rgb(90, 200, 250) are the same color; pick whichever your tooling expects.
How is alpha handled?
8-digit HEX encodes alpha as the last byte (#RRGGBBAA), and rgba() takes alpha as 0–1. An alpha of FF / 1.0 is fully opaque.

Workflows that solve this

Learn more

Want to understand why?

Related tools