Skip to content
siter.io home

HEX to RGB converter

Paste a hex value and read it back as RGB, HSL and CSS, with the contrast against black and white. It runs in this tab, so nothing is uploaded.

#2F80ED

  • RGB rgb(47, 128, 237)
  • HEX #2F80ED
  • HSL hsl(214, 84%, 56%)
  • CSS #2F80ED
  • 47 128 237

In the RGB field, the up and down arrow keys change the number under the cursor. Hold Shift to move it by 10.

The HEX and RGB fields also read code. Paste a CSS line, 0xFF2F80ED, Color(0xFF2F80ED), oklch() or a color name.

Contrast against black and white

  • 5.43 to 1

    Black text on this color

    AA ✓AAA ✗AA large ✓

  • 3.87 to 1

    White text on this color

    AA ✗AAA ✗AA large ✓

Black text is the stronger pairing on this color.

Any hex, read right.

  • Shorthand, spelled out

    #ABC is #AABBCC with every digit doubled, so only repeating pairs have a short form. A fourth digit is alpha.

  • The Android alpha trap

    Android writes alpha first. Switch on Alpha first and purple #802F80ED becomes #2F80ED at half strength.

  • Paste the whole line

    The fields read a CSS line, 0x values, Flutter code, oklch() and color names, so skip the cleanup.

What a hex color actually is.

Six digits, three channels. Each pair is one number from 0 to 255, written in base 16.

  1. One pair, one channel

    Hex is RGB written in base 16. 2F is red, 80 is green, ED is blue.

  2. Sixteens plus the rest

    The first digit counts sixteens and the second adds ones. 2F is 2 × 16 + 15, which is 47.

  3. FF is the ceiling

    Two hex digits top out at FF, which is 255, a full bar.

  4. Channels add up

    Light all three and you get #2F80ED, where black text scores 5.43 to 1.

How to convert HEX to RGB.

  1. Paste your hex

    A bare value or a whole CSS line, upper or lower case. Every field updates as you type.

  2. Nudge it

    Drag a channel slider, or press the arrow keys in the RGB field.

  3. Copy what you need

    RGB, HSL or CSS in one click, or open More for Tailwind, SwiftUI and Flutter.

Every length the field reads.

LengthTry itReads asAlpha
3 digits#ABC#AABBCC, every digit doubledStays as set
4 digits#ABCD#AABBCC86.7%, from D doubled
6 digits#2F80ED47, 128, 237Stays as set
8 digits#2F80ED8047, 128, 23750.2%, from the last pair
0x and 8 digits0xFF2F80ED47, 128, 237100%, from the first pair
Any other length#2F80ERefused, with the reason. The last good color staysNo change

HEX to RGB questions.

All free tools
Is hex a different color space from RGB?

No, hex is the same three sRGB channels written in base 16, so nothing is lost either way. For the other direction, RGB to HEX is this same converter.

Why is my eight-digit hex the wrong color?

Its alpha is probably at the front, since CSS reads #RRGGBBAA and Android writes #AARRGGBB. Switch on Alpha first, which appears for eight digits, and 0xFF2F80ED turns it on by itself.

Why do designers hand over hex?

Because it is one token with no spaces, commas or brackets. It survives a Slack message, a JSON theme and a spreadsheet cell intact, even when the code that uses it wants numbers.

When do I need the channels back?

When you do something to a color rather than name it. A hover state, a tint, a gradient stop and a canvas fill are all arithmetic on three numbers.

Can hex describe every color?

No, only sRGB, so a Display P3 red or a vivid oklch() falls outside it. Paste one here and the tool clips the channels to fit, and tells you it did.

What does the contrast score mean?

It is the WCAG ratio against black and white, with alpha left out: body text needs 4.5 to 1, large text 3 to 1 and AAA 7 to 1. For any other pair, use the contrast checker.

Start with the design
you already have.

Install the Figma plugin, send a frame across, and finish it on the canvas.