Free 100% In-Browser Tool

Hex to RGB Converter: Hex Color Code to RGB & HSL

Convert hexadecimal color codes to RGB, RGBA, and HSL values.

Quick Answer:Paste any hex color code (e.g., #3B82F6) to view instant RGB (59, 130, 246), HSL, and ready-to-copy CSS properties.
Initializing tool...

Privacy First: 100% Client-Side Processing

Processed in your browser. Files are never uploaded.

How to Use the Hex to RGB Converter: Hex Color Code to RGB & HSL

  1. 1Enter your hex color code (with or without '#').
  2. 2View live color preview square.
  3. 3Review RGB, RGBA, HSL, and CSS snippet formats.
  4. 4Click any format to copy it to your clipboard.

Formula & How It Works

Hex to RGB Math

R = parseInt(hex.slice(1,3), 16), G = parseInt(hex.slice(3,5), 16), B = parseInt(hex.slice(5,7), 16)

Parses two-digit hex pairs into base-10 integers from 0 to 255.

Worked Examples

Toolzy Blue

Input: #3B82F6

Explanation: R: 0x3B=59, G: 0x82=130, B: 0xF6=246.

Result: rgb(59, 130, 246)

Pure White

Input: #FFF

Explanation: Shorthand expanded to #FFFFFF.

Result: rgb(255, 255, 255)

Alpha Opacity

Input: #FF000080

Explanation: 8-digit hex with 50% opacity.

Result: rgba(255, 0, 0, 0.5)

Frequently Asked Questions

How do you convert hex to RGB?▼

Break the hex into pairs (RR, GG, BB) and convert each 2-digit hex number to decimal (0-255).

What is #FFFFFF in RGB?▼

#FFFFFF is rgb(255, 255, 255), representing pure white.

What is #000000 in RGB?▼

#000000 is rgb(0, 0, 0), representing pure black.

Can I use 3-digit hex codes?▼

Yes, 3-digit shorthand like #F00 expands to #FF0000 (rgb(255, 0, 0)).

How do 8-digit hex codes work?▼

The last two characters represent alpha opacity (e.g. #00000080 is black at 50% opacity).

Is this tool free?▼

Yes, Toolzy color tools are 100% free and run client-side.

Quick Reference & Conversion Table

Color NameHex CodeRGB FormatHSL Format
Pure Black#000000rgb(0, 0, 0)hsl(0, 0%, 0%)
Pure White#FFFFFFrgb(255, 255, 255)hsl(0, 0%, 100%)
Vibrant Red#EF4444rgb(239, 68, 68)hsl(0, 84%, 60%)
Emerald Green#10B981rgb(16, 185, 129)hsl(160, 84%, 39%)
Royal Blue#3B82F6rgb(59, 130, 246)hsl(217, 91%, 60%)

⚠️ Common Pitfalls to Avoid

  • •Omitting the '#' symbol or using invalid hex characters outside 0-9 and A-F.
  • •Forgetting that 8-digit hex codes place alpha at the end (RRGGBBAA).

💡 Practical Real-World Uses

  • •Translating Figma and UI design color tokens into CSS stylesheets.
  • •Converting brand hex codes for canvas and WebGL graphics programming.
  • •Configuring Tailwind CSS custom color palettes.
Last reviewed & updated: 2026-11-10
Free & Open Access
Related Utilities

Explore complementary calculators and converters with instant client-side execution

More in

Explore Other Tool Categories

Browse our full collection of 50 free web utilities

View All 8 Categories