Home Design Tools RGB to HEX

RGB to HEX - With Contrast Checker & Eyedropper

Drag the R, G, B sliders or type exact values to get instant HEX, HSL, and CMYK output. Check WCAG accessibility contrast, preview the color on real buttons and cards, pick RGB values straight from an image, and export ready-to-use code for CSS, Tailwind, Swift, or Android.

Always Free Live RGB sliders WCAG contrast checker Runs in browser
HEX · HSL · CMYK · CSS · Tailwind · Swift · Android
Drag sliders or type exact 0-255 values for each channel
WCAG contrast ratio checked automatically
Export to CSS, Tailwind, Swift, and Android instantly
59, 130, 246 34, 197, 94 239, 68, 68 245, 158, 11 147, 51, 234
#3B82F6
R
G
B
rgb(59, 130, 246)
Upload any image, then click on it to pick RGB values
WCAG Accessibility Contrast
Sample text
on white background
-
Sample text
on dark background
-
Live preview on real UI
Button
Text on white
Sample heading
Sample body text
Text on dark
Sample heading
Sample body text
Card accent
Card title
Supporting text
Border / outline
Outlined box
Tag / badge
Status
Color variations - click any to convert it
Shades (darker)
Tints (lighter)
Harmonies
Closest matches
Color blindness simulation

Other converters give you
a number. This gives you a decision.

Drag-to-explore sliders, accessibility built in, live preview on real UI, and code-ready exports.

Drag-to-explore sliders

Adjust R, G, B and watch HEX, contrast, and preview update live - faster than typing a hex code.

visual, not just numeric

WCAG contrast built in

Every RGB value is automatically checked against white and black backgrounds for WCAG AA/AAA pass/fail.

accessibility, not an afterthought

Live preview on real UI

See your color as an actual button, card, badge, and border - not just a flat square.

buttons, cards, badges

Code-ready exports

Copy as CSS variable, Tailwind class, SwiftUI Color, or Android Color.parseColor() - the exact syntax for your stack.

7 export formats

Eyedropper updates the sliders

Click any pixel in an uploaded image and watch the R, G, B sliders jump to that exact value.

image → sliders → hex

Color blindness simulation

See your RGB color under protanopia, deuteranopia, and tritanopia - make sure your palette works for everyone.

real accessibility check

Convert RGB to HEX in seconds

1

Set your RGB values

Drag the sliders or type exact 0-255 values, or use the eyedropper to pick a color from an uploaded image.

2

Check it works

Review the contrast ratio against white and dark backgrounds, and preview the color on real buttons and cards.

3

Export to your code

Copy the HEX value plus the exact syntax for CSS, Tailwind, Swift, or Android.

RGB to HEX - the conversion and why sliders help

RGB describes a color as three values from 0 to 255 - one each for red, green, and blue intensity. Converting to HEX means converting each decimal value to a two-digit hexadecimal number and concatenating them. rgb(59, 130, 246) becomes #3B82F6 because 59 in hex is 3B, 130 is 82, and 246 is F6.

Why sliders beat typing a HEX code directly

If you already have a color and just want its HEX code, typing is fine. But RGB sliders are far better when you're designing a color - nudging the blue channel up by 10 to make a color feel cooler is one drag of a slider, whereas doing the same in HEX requires mental hex-to-decimal math.

Why contrast checking matters here. WCAG 2.1 requires a 4.5:1 contrast ratio for normal text to pass AA. Adjusting RGB sliders while watching the live contrast ratio update lets you find an accessible color without leaving the page.

What happens with out-of-range RGB values

Each RGB channel must be between 0 and 255. If you type a value outside this range, this tool clamps it to the nearest valid number and shows a brief warning, rather than silently producing an invalid HEX code.

RGB valueHEX equivalentMeaning
000None of this channel - fully off
12880Roughly half intensity
255FFFull intensity - fully on

Using the eyedropper to reverse-engineer a color

A common real-world need: someone sends a screenshot and asks "what RGB value is that blue?" Upload the image here and click the exact pixel - the R, G, B sliders jump to the extracted values immediately, and every other format updates alongside them.

Color conversion questions,
answered.

Ask a question
Each RGB value from 0-255 converts to a two-digit hexadecimal number. For example, rgb(59, 130, 246) converts to #3B82F6. This tool performs the conversion instantly as you adjust the sliders or type values.
Each of the Red, Green, and Blue channels must be a whole number between 0 and 255. If you enter a value outside this range, the tool clamps it and shows a warning.
WCAG AA requires at least 4.5:1 for normal text and 3:1 for large text or UI components. WCAG AAA requires 7:1 for normal text. This tool calculates the exact ratio automatically.
Upload any image, then click anywhere on it to extract the exact RGB values of that pixel. The sliders update instantly. This works entirely in your browser - the image is never uploaded to a server.
Set your RGB values and the tool automatically calculates the closest matching color in the default Tailwind CSS palette, showing you the class name like bg-blue-500.
Yes. The color blindness simulator shows how your chosen RGB color would appear under protanopia, deuteranopia, or tritanopia.