← Back to blog
5 min read

How to Convert HEX to RGB (and Back) on Mac

The simple math behind HEX↔RGB conversion — plus how to convert any color instantly from your clipboard on macOS, with a live swatch.

A designer hands you #1E90FF. Your CSS needs rgb(30, 144, 255). Or your code logs an rgba() value and you want the hex to drop into a style guide. Either way, you end up googling a color converter, pasting, copying the result, and pasting it back.

It's a two-second task buried in a ten-second round trip. Here's what HEX and RGB actually are, how to convert between them by hand when you need to, and how to do it instantly from your clipboard on a Mac.

HEX and RGB are the same color, written differently

Both formats describe a color using three channels — red, green, and blue — each ranging from 0 to 255. They just write those numbers in different bases:

  • HEX writes each channel as a two-digit hexadecimal (base-16) number, joined together and prefixed with #. So #1E90FF is 1E, 90, FF.
  • RGB writes each channel as a regular decimal (base-10) number in a function: rgb(30, 144, 255).

#1E90FF and rgb(30, 144, 255) are the exact same blue — one's just in hex, the other in decimal.

Add a fourth value for transparency and you get the alpha variants: an 8-digit hex like #1E90FF80, or rgba(30, 144, 255, 0.5).

How to convert HEX to RGB by hand

Split the six hex digits into three pairs, and convert each pair from hexadecimal to decimal. Take #1E90FF:

  • 1E → 30
  • 90 → 144
  • FF → 255

Result: rgb(30, 144, 255). The math for one pair: the first digit is the sixteens place, the second is the ones. So 1E is (1 × 16) + 14 = 30 (because E is 14 in hex). FF is (15 × 16) + 15 = 255 — which is why FF is the maximum for a channel.

How to convert RGB to HEX by hand

Go the other way: take each decimal channel and write it as a two-digit hex number. Take rgb(30, 144, 255):

  • 30 → 1E
  • 144 → 90
  • 255 → FF

Join them: #1E90FF. The only thing to watch is padding — a channel under 16 (like 5) becomes 05, not 5, so each channel is always two digits.

A few common colors for reference

ColorHEXRGB
White#FFFFFFrgb(255, 255, 255)
Black#000000rgb(0, 0, 0)
Red#FF0000rgb(255, 0, 0)
Green#00FF00rgb(0, 255, 0)
Blue#0000FFrgb(0, 0, 255)
Dodger blue#1E90FFrgb(30, 144, 255)

The faster way: convert from your clipboard

Doing the math by hand is fine once. Doing it twenty times a day while you're building a UI is not — and that's where a color-converter tab eats your time.

ClipBear converts colors directly from your clipboard, on your Mac. Copy a color in any common format — HEX, RGB, RGBA, HSL, or HSLA — and ClipBear detects it, shows a live swatch preview so you can see exactly which color it is, and offers one-click conversion to the other formats. Copy #1E90FF, and rgb(30, 144, 255) is one click away, ready to paste. No tab, no website, no manual math.

Because it also handles HSL and HSLA, you're not limited to HEX and RGB — you can round-trip between all the color formats CSS understands.

Frequently asked questions

What's the difference between RGB and HSL? RGB describes a color by its red, green, and blue amounts. HSL describes the same color by hue, saturation, and lightness — often more intuitive when you want to nudge a color lighter or more saturated. ClipBear converts between HEX, RGB, RGBA, HSL, and HSLA.

How do I add transparency? Use an 8-digit hex (the last two digits are the alpha, 00FF) or the rgba() / hsla() functions, where the final value is an opacity from 0 to 1.

Is #1E90FF the same as #1e90ff? Yes. Hex color codes are case-insensitive, so uppercase and lowercase are identical.

Do I need to be online to convert a color? No. Conversion is pure math. ClipBear does it on-device, so it works offline and your colors never leave your Mac.

Stop opening a converter tab

Converting HEX to RGB (or to HSL, or back) is a tiny, constant task in any front-end workflow. Doing it from your clipboard — with a swatch so you can actually see the color — turns a ten-second round trip into a single click.

Try ClipBear free for 14 days at clipbear.app. Everything stays on your Mac.