OnlineToolsHub

Hex to RGB Converter

Convert hex color codes to RGB and RGB to hex. Preview colors, get HSL values and copy with one click.

Hex: #CCCCCC
RGB: rgb(204, 204, 204)
HSL: hsl(0, 0%, 80%)

What is Hex to RGB Conversion?

Hex to RGB conversion is the process of translating a hexadecimal color code (used in web design and CSS) into its equivalent Red, Green and Blue component values. A hex color code like #FF5733 represents a combination of red (FF = 255), green (57 = 87) and blue (33 = 51) intensity values. Web designers, developers and graphic artists frequently need to convert between these formats for different tools and platforms.

How to Use This Converter

Enter a hex color code (with or without the # symbol) in the Hex to RGB mode, or enter individual R, G and B values (0 to 255) in the RGB to Hex mode. The converter works in real time as you type. You will see an instant color preview swatch, and the equivalent values in Hex, RGB and HSL formats. Click the Copy button next to any format to copy it to your clipboard for use in your projects.

Conversion Formula

To convert hex to RGB, each pair of hex digits is converted to its decimal equivalent:

R = parseInt(hex[1..2], 16)

G = parseInt(hex[3..4], 16)

B = parseInt(hex[5..6], 16)

Shorthand hex codes like #FFF are expanded to #FFFFFF by doubling each digit. To convert RGB to hex, each decimal value is converted to a two-digit hexadecimal string and concatenated with a # prefix.

Frequently Asked Questions

What is a hex color code?

A hex color code is a six-character string (preceded by #) that represents a color using hexadecimal values for red, green and blue channels. For example, #000000 is black and #FFFFFF is white.

What is the difference between RGB and HSL?

RGB defines colors by their red, green and blue light components. HSL defines colors by Hue (0-360 degrees), Saturation (0-100%) and Lightness (0-100%). HSL is often more intuitive for adjusting color shades and tints.

Can I enter shorthand hex codes like #FFF?

Yes. This converter automatically expands shorthand three-character hex codes. For example, #FFF becomes #FFFFFF and #F00 becomes #FF0000.

Related tools

Explore all tools

Age Calculator

Find exact age in years, months and days

BMI Calculator

Check Body Mass Index and weight range

Loan EMI Calculator

Monthly EMI for home, car or personal loan

SIP Calculator

Estimate future value of SIP investment

FD Calculator

Fixed Deposit maturity and interest

RD Calculator

Recurring Deposit maturity and interest

GST Calculator

Add or remove GST from any amount

Percentage Calculator

Find X% of Y, percentage change and more

Period Calculator

Estimate next period and fertile window

Pregnancy Due Date

Estimate due date from last period

Date Difference

Find days between two dates

IRCTC 60 Days

Find booking date for train tickets

Compound Interest

Calculate compound interest with flexible compounding

PPF Calculator

Public Provident Fund maturity and interest

Gratuity Calculator

Calculate gratuity based on salary and tenure

HRA Calculator

Find HRA exemption for tax saving

Salary Calculator

CTC to in-hand salary breakdown

Income Tax Calculator

Calculate tax under Old and New regime

Simple Interest

Calculate simple interest on any amount

CAGR Calculator

Compound annual growth rate

Discount Calculator

Find discount amount and final price

Profit & Loss

Calculate profit or loss percentage

ROI Calculator

Return on Investment calculator

BMR Calculator

Basal Metabolic Rate and daily calories

Area Calculator

Calculate area of any shape

Speed Distance Time

Calculate speed, distance or time

Fuel Cost Calculator

Calculate fuel cost for any trip

Average Calculator

Find mean, median and mode

Tip Calculator

Calculate tip and split the bill

Number to Words

Convert numbers to words for cheques

Electricity Cost

Calculate electricity usage cost

Unit Converter

Convert length, weight, temperature

Time Calculator

Add or subtract hours and minutes

Inflation Calculator

Calculate future value after inflation

Break-even Calculator

Find break-even point for business

GST Reverse Calculator

Find base price from GST-included amount

Lumpsum Calculator

One-time investment future value

SWP Calculator

Systematic withdrawal plan calculator

Salary Hike Calculator

Calculate new salary after hike

Home Loan Eligibility

Check how much home loan you can get

Car Loan Calculator

Calculate car loan EMI and total cost

CGPA to Percentage

Convert CGPA to percentage easily

Marks Required

Find marks needed to pass or score target

Ideal Weight Calculator

Find ideal body weight by height

Body Fat Calculator

Estimate body fat percentage

Water Intake Calculator

Daily water requirement by weight

Business Days Calculator

Count working days between dates

Countdown Calculator

Days remaining until a future date

Hex to RGB Converter

Convert hex color codes to RGB

Random Number Generator

Generate random numbers in any range

Quadratic Solver

Solve quadratic equations instantly

Age Difference

Find age difference between two people

Work Hour Calculator

Calculate total work hours and pay