Developer tools

Hex to RGB Converter

Convert hex colour codes to RGB, RGBA, HSL, and CMYK instantly with a live preview swatch.

Includes the conversion formula and CSS, JavaScript, and Python snippets. Free and private in your browser.

Accepts #RGB, #RGBA, #RRGGBB, #RRGGBBAA, or named CSS colours.

From RGB → hex: #3ECF8E

Live preview swatch

#3ECF8E

RGB

rgb(62, 207, 142)

RGBA

rgba(62, 207, 142, 1)

HSL

hsl(153, 60%, 53%)

HSV

hsv(153, 70%, 81%)

CMYK

cmyk(70%, 0%, 31%, 19%)

Hex

#3ECF8E

Contrast vs white

2:1

Contrast vs black

10.52:1

Hex to RGB formula

R = int(RR, 16)   # 0–255
G = int(GG, 16)
B = int(BB, 16)
# Shorthand #RGB expands to #RRGGBB (each digit doubled).

Code snippets

CSS

color: #3ECF8E;
background: rgb(62, 207, 142);
background: rgba(62, 207, 142, 1);

JavaScript

const hex = "#3ECF8E";
const r = 62, g = 207, b = 142;
// parseInt(hex.slice(1, 3), 16)

Python

hex_color = "3ECF8E"
r, g, b = 62, 207, 142
# int(hex_color[0:2], 16)

What Is a Hex to RGB Converter?

Hexadecimal colour codes (#RRGGBB) store each sRGB channel as two hex digits. A hex to RGB converter expands that into 0–255 red, green, and blue values for CSS, design tools, and code. This page also outputs RGBA (with opacity), HSL, HSV, CMYK, and a live swatch.

Hex to RGB Formula

Split #RRGGBB into pairs and parse each as base 16. Three-digit shorthand #RGB expands by doubling every digit.

R = int(RR, 16)   # 0–255
G = int(GG, 16)
B = int(BB, 16)
# Shorthand #RGB expands to #RRGGBB (each digit doubled).

HSL, CMYK, and WCAG Contrast

HSL is handy for adjusting lightness in CSS. CMYK estimates print-style channels from sRGB (approximate, not ICC-managed). Contrast ratios against white and black use relative luminance as a quick WCAG check— always verify in context, including for colour blindness.

Hex to RGB FAQs

How do I convert hex to RGB?
Take a hexadecimal colour code such as #3ECF8E, split it into RR, GG, and BB pairs, then convert each pair from base 16 to a 0–255 channel. This hex to RGB converter also expands three-digit shorthand and shows RGBA, HSL, HSV, and CMYK.
What is the hex to RGB formula?
For #RRGGBB, R = parseInt(RR, 16), G = parseInt(GG, 16), B = parseInt(BB, 16). Shorthand #RGB doubles each digit to #RRGGBB before converting. Optional AA adds an alpha channel for RGBA.
Can I convert RGB back to hex?
Yes. Enter R, G, and B (0–255) and optional opacity to get a hex colour code and CSS values. That covers rgb hex to RGB workflows in either direction.
Does this include HSL and CMYK?
Yes. After hex to RGB conversion you get HSL, HSV, and CMYK percentages plus a live swatch in the sRGB colour space used by CSS.
How do I convert hex to RGB in JavaScript or Python?
In JS use parseInt(hex.slice(1, 3), 16) for each pair (or this page’s snippets). In Python use int(hex[0:2], 16). The tool is for quick checks without writing a script.
What about WCAG contrast?
The tool shows approximate contrast ratios against white and black using relative luminance. Use them as a starting point for WCAG checks; always verify in your full UI.

Related Developer & SEO Tools

Other LiveTechHacks utilities that also run in your browser.

JWT Decoder

Decode JWT tokens instantly and inspect the header, payload, claims, signature details, and expiration time in a readable format.

Open Tool

Slug Generator

Turn any title or phrase into a clean, SEO-friendly URL slug. Accents, symbols, and optional stop words are handled locally in your browser.

Open Tool

Passphrase Generator

Generate strong, memorable passphrases from the EFF diceware wordlist. Pick your word count and separator. Runs offline — nothing is ever transmitted.

Open Tool

Cron Expression Generator

Build cron expressions visually and preview the next run times instantly. Supports standard crontab, Quartz, Spring and AWS syntax. Free, with no sign-up.

Open Tool

YAML ↔ JSON Converter

Convert YAML to JSON and JSON to YAML instantly, with validation and error highlighting. Works with Kubernetes, OpenAPI and Docker Compose files.

Open Tool

UUID Generator

Generate random UUID v4, v1 and v7 identifiers in bulk, up to 1,000 at a time. Copy or download instantly in your browser.

Open Tool

Epoch Converter

Convert Unix timestamps to readable dates and back, in seconds or milliseconds. Live clock, timezones, and code snippets.

Open Tool

Base64 Encoder & Decoder

Encode and decode Base64 strings, files and images instantly. Supports base64url and data URIs in your browser.

Open Tool

CSV ↔ JSON Converter

Convert CSV to JSON and JSON to CSV instantly. Custom delimiters, headers, quoted fields, and nested object flattening.

Open Tool

HTML Minifier

Minify HTML to cut page weight. Strip comments, collapse whitespace, and review before-and-after size — free in your browser.

Open Tool

Case Converter

Convert text between uppercase, lowercase, sentence case, title case, camelCase, and snake_case. Supports AP and Chicago title style.

Open Tool

JSON Formatter & Validator

Format, validate and beautify JSON with a collapsible tree view and line/column error reporting. Free, private, no sign-up.

Open Tool

Markdown to HTML Converter

Convert Markdown to clean HTML with a live side-by-side preview. Supports GFM, tables, and code highlighting.

Open Tool

XML Formatter Online

Format, indent and validate XML with error highlighting and a collapsible tree view. Works with SOAP, RSS, and sitemaps.

Open Tool

Diff Checker

Compare text or code side by side with line and character highlighting. Ignore whitespace or case. Free and private.

Open Tool

Binary to Decimal Converter

Convert between binary, decimal, hex, and octal with step-by-step working. Supports signed values and bit widths.

Open Tool

Regex Tester

Test regular expressions live with match highlighting, capture groups, and plain-English explanations.

Open Tool

ASCII Table

Complete ASCII chart with decimal, hex, binary, and octal values—plus extended ASCII. Searchable and printable.

Open Tool

CSS Minifier

Minify CSS online—strip comments and whitespace, collapse shorthand, shorten colors, and see bytes saved.

Open Tool