Hex Calculator: Convert Hex Color Codes to RGB, HSL & CMYK Instantly
One of the most common frustrations for designers and developers is needing a color in a different format — a client sends a HEX code, but the design software needs RGB, or the print shop needs CMYK. Manually converting between color formats is slow and easy to get wrong. A hex calculator solves this problem instantly by converting any HEX color code into RGB, HSL, and CMYK values, and back again.
Enter Your Values
Your Results
Quick navigation
How hex calculator works

A hex calculator performs arithmetic like addition, subtraction, multiplication and division on hexadecimal (base-16) numbers. It converts inputs to decimal, does the math, and shows the result back in hex, decimal, and often binary too.
Things to keep in mind
- Uses digits 0-9 and letters A-F
- Easy to misread similar-looking hex digits
- Negative results depend on the sign convention used
- Large hex values can be hard to sanity-check by eye
Online calculators
How Does the Calculator Work?
Webequa’s calculator takes a color value in one format and converts it into the others. Here’s what you’ll need:
- Hex code – a 6-digit code starting with
#(e.g.#3498DB), or a 3-digit shorthand (e.g.#39D) - Or RGB values – three numbers between 0 and 255 for red, green, and blue
- Or HSL values – hue (0–360°), saturation (0–100%), and lightness (0–100%)
- Output format – choose which formats you want displayed (RGB, HSL, CMYK, or all)
Once entered, the calculator parses the input, converts it to a common internal format, and calculates the equivalent values in every other color model.
Formula
Webequa’s calculator uses the standard color conversion formulas used in digital design and printing.
Step 1: Convert HEX to RGB
Split the 6-digit hex code into three pairs: RRGGBB
Convert each pair from base-16 to base-10 (decimal)
R = hex_to_decimal(RR)
G = hex_to_decimal(GG)
B = hex_to_decimal(BB)Step 2: Normalize RGB (0–1 scale)
R' = R ÷ 255
G' = G ÷ 255
B' = B ÷ 255Step 3: Convert RGB to HSL
Cmax = max(R', G', B')
Cmin = min(R', G', B')
Δ = Cmax − Cmin
Lightness (L) = (Cmax + Cmin) ÷ 2
Saturation (S):
If Δ = 0: S = 0
If L ≤ 0.5: S = Δ ÷ (Cmax + Cmin)
If L > 0.5: S = Δ ÷ (2 − Cmax − Cmin)
Hue (H):
If Δ = 0: H = 0
If Cmax = R': H = 60 × (((G' − B') ÷ Δ) mod 6)
If Cmax = G': H = 60 × (((B' − R') ÷ Δ) + 2)
If Cmax = B': H = 60 × (((R' − G') ÷ Δ) + 4)Step 4: Convert RGB to CMYK
K = 1 − max(R', G', B')
C = (1 − R' − K) ÷ (1 − K)
M = (1 − G' − K) ÷ (1 − K)
Y = (1 − B' − K) ÷ (1 − K)
(C, M, Y, K expressed as percentages)Variable explanations:
- R, G, B — the red, green, and blue intensity values, each on a 0–255 scale
- Δ (Delta) — the difference between the highest and lowest RGB values, used to determine hue and saturation
- L (Lightness) — how light or dark the color is, from 0% (black) to 100% (white)
- K (Key/Black) — the amount of black ink used in CMYK printing, calculated first since it affects the other three values
Assumptions:
- Hex input is assumed to be a valid 6-digit or 3-digit code
- RGB to CMYK conversion is a standard mathematical approximation, not a color-managed print profile
- Calculations assume the sRGB color space, the default for most screens and websites
- Print results may vary depending on the printer, paper, and ink profile used
Note: RGB-to-CMYK conversion is only an estimate. Professional print work should use a color-managed workflow with the printer’s specific ICC profile, since the same RGB value can produce different results on different printers.
How to Use This Calculator
- Enter a HEX code, or switch to RGB or HSL input mode.
- Type or paste your color value.
- Select which output formats you want to see.
- Click Calculate.
- Review the converted RGB, HSL, and CMYK values.
- Copy any format directly for use in your design tool or code.
Tip: When copying a hex code from a design tool, make sure it includes all six digits — shorthand codes like
#3498DBwritten as#39Donly work when both digits in each pair match.
Example Calculations
Example 1: Web Blue
Input:
| Value | Result |
|---|---|
| Hex Code | #3498DB |
Step 1: Convert hex pairs to decimal:
34 → 52 98 → 152 DB → 219
RGB = (52, 152, 219)Step 2: Normalize:
R' = 52 ÷ 255 = 0.2039
G' = 152 ÷ 255 = 0.5961
B' = 219 ÷ 255 = 0.8588Step 3: Calculate HSL:
Cmax = 0.8588 (B), Cmin = 0.2039 (R), Δ = 0.6549
L = (0.8588 + 0.2039) ÷ 2 = 0.5314 → 53%
S = 0.6549 ÷ (2 − 0.8588 − 0.2039) = 0.6988 → 70%
H = 60 × (((0.2039 − 0.5961) ÷ 0.6549) + 4) = 204°
HSL = (204°, 70%, 53%)Step 4: Calculate CMYK:
K = 1 − 0.8588 = 0.1412 → 14%
C = (1 − 0.2039 − 0.1412) ÷ 0.8588 = 76%
M = (1 − 0.5961 − 0.1412) ÷ 0.8588 = 31%
Y = (1 − 0.8588 − 0.1412) ÷ 0.8588 = 0%
CMYK = (76%, 31%, 0%, 14%)Result: #3498DB = RGB(52, 152, 219) = HSL(204°, 70%, 53%) = CMYK(76%, 31%, 0%, 14%)
Example 2: Alert Red
Input:
| Value | Result |
|---|---|
| Hex Code | #E74C3C |
Step 1: Convert hex pairs to decimal:
E7 → 231 4C → 76 3C → 60
RGB = (231, 76, 60)Step 2: Normalize:
R' = 231 ÷ 255 = 0.9059
G' = 76 ÷ 255 = 0.2980
B' = 60 ÷ 255 = 0.2353Step 3: Calculate HSL:
Cmax = 0.9059 (R), Cmin = 0.2353 (B), Δ = 0.6706
L = (0.9059 + 0.2353) ÷ 2 = 0.5706 → 57%
S = 0.6706 ÷ (2 − 0.9059 − 0.2353) = 0.7808 → 78%
H = 60 × ((0.2980 − 0.2353) ÷ 0.6706) = 6°
HSL = (6°, 78%, 57%)Step 4: Calculate CMYK:
K = 1 − 0.9059 = 0.0941 → 9%
C = (1 − 0.9059 − 0.0941) ÷ 0.9059 = 0%
M = (1 − 0.2980 − 0.0941) ÷ 0.9059 = 67%
Y = (1 − 0.2353 − 0.0941) ÷ 0.9059 = 74%
CMYK = (0%, 67%, 74%, 9%)Result: #E74C3C = RGB(231, 76, 60) = HSL(6°, 78%, 57%) = CMYK(0%, 67%, 74%, 9%)
Common Hex Color Reference Chart
| Color Name | Hex Code | RGB |
|---|---|---|
| Black | #000000 | (0, 0, 0) |
| White | #FFFFFF | (255, 255, 255) |
| Red | #FF0000 | (255, 0, 0) |
| Green | #00FF00 | (0, 255, 0) |
| Blue | #0000FF | (0, 0, 255) |
| Gray | #808080 | (128, 128, 128) |
| Navy | #000080 | (0, 0, 128) |
| Teal | #008080 | (0, 128, 128) |
| Gold | #FFD700 | (255, 215, 0) |
| Crimson | #DC143C | (220, 20, 60) |
Color Format Use Cases
| Format | Typically Used For |
|---|---|
| HEX | CSS, web design, design tools |
| RGB | Digital screens, code, digital painting |
| HSL | Adjusting color intuitively in CSS/design tools |
| CMYK | Commercial printing, brochures, packaging |
Understanding Your Results
- RGB values — the exact red, green, and blue intensities that make up the color on screen
- HSL values — a more intuitive breakdown showing the color’s hue, how saturated it is, and how light or dark it is
- CMYK values — an estimated print equivalent, useful for getting close to the right color before a professional print check
- Hex code — the compact code most commonly used in web design and CSS
Always treat the CMYK conversion as a starting point rather than a final print value — true print accuracy depends on the printer’s color profile.
Factors That Affect Color Accuracy
Several real-world factors can affect how a converted color actually appears:
- Screen calibration — uncalibrated monitors can display the same hex code differently
- Color space — most calculators assume sRGB, but some professional tools use wider color spaces like Adobe RGB
- Print profile — CMYK values shift depending on the printer, ink set, and paper type
- Ambient lighting — the environment a screen is viewed in affects perceived color
- Software rendering differences — some browsers and apps render colors with slightly different gamma settings
- File format compression — saving images in lossy formats can subtly shift color values
Benefits of Using a Hex Calculator
- Free and instant results
- Eliminates manual conversion errors
- Supports HEX, RGB, HSL, and CMYK in one place
- Works both forward and in reverse (RGB/HSL to HEX)
- Useful for web design, app design, and print preparation
- Saves time when matching brand colors across platforms
- Helps developers copy exact CSS-ready values
- Useful for building consistent color palettes
- Makes it easy to compare lightness and saturation between colors
- Free to use as often as needed with no registration
Limitations
- CMYK conversion is an approximation — not a substitute for a color-managed print profile
- Assumes sRGB color space — results may differ slightly in wider color gamuts
- Does not detect color blindness accessibility issues — use a dedicated contrast checker for that
- 3-digit hex shorthand only works for doubled pairs — irregular shorthand codes are not valid hex
- Does not account for screen calibration — the same hex code can look different across devices
Disclaimer: Results are estimates based on standard color conversion formulas. Actual on-screen or printed color may vary depending on device calibration, color profile, and output method. Always verify critical brand colors with a professional print proof.
Common Mistakes
- Forgetting the
#symbol when pasting a hex code - Using a 3-digit shorthand incorrectly for a color that isn’t a doubled pair
- Assuming CMYK output will exactly match a printed result
- Mixing up RGB order (entering values as BGR instead of RGB)
- Not checking whether a design tool expects percentages or 0–255 values for RGB
- Assuming HSL lightness and simple “brightness” are the same thing
- Copying a hex code with extra spaces or characters
- Using screen colors directly for print without checking CMYK
- Assuming all screens will render the exact same hex code identically
- Forgetting that black text on a dark background may still fail contrast even with a “readable” hex value
Tips for Accurate Results
- Always include all six digits of a hex code where possible, rather than relying on shorthand
- Double-check RGB values are within the 0–255 range before converting
- For print projects, treat the CMYK output as a starting point and confirm with a physical proof
- Use HSL when you want to create lighter or darker shades of the same color easily
- Keep a saved reference sheet of your brand’s exact hex codes to avoid drift over time
- When matching colors across tools, always copy the hex code rather than eyeballing the RGB sliders
- Check color contrast separately when designing for accessibility
- Calibrate your monitor periodically if color accuracy matters for your work
- Use the same color space (sRGB) across your design tools to avoid unexpected shifts
- Save frequently used brand colors in a swatch library rather than re-typing hex codes each time
Why Trust Webequa?
- ✔ Accurate, standards-based formulas
- ✔ Verified calculations
- ✔ Expert-reviewed information
- ✔ Privacy-first — no data stored
- ✔ No registration required
- ✔ Mobile-friendly design
- ✔ Fast loading, no clutter
- ✔ Free forever
- ✔ Regularly updated content
- ✔ Accessible worldwide
Related Calculators
- RGB to Hex Calculator
- Color Contrast Checker
- CMYK to RGB Calculator
- HSL Color Picker
- Pantone Color Finder
- Gradient Generator
- Color Palette Generator
- Image Color Extractor
- Percentage Calculator
- Unit Converter
- CSS Box Shadow Generator
- Font Pairing Tool
Scientific and Trade References
- World Wide Web Consortium (W3C) — CSS Color Module Specification
- Web Content Accessibility Guidelines (WCAG) — Color Contrast Requirements
- International Color Consortium (ICC) — Color Management Standards
- Adobe — Understanding Color Modes and Spaces
- Pantone — Color Matching System Overview
- sRGB Color Space Standard — IEC 61966-2-1
Conclusion
Getting color values right the first time saves time and avoids mismatches between screen and print, or between different design tools. A hex calculator gives you a fast, accurate way to convert any color into RGB, HSL, and CMYK — so you always have the exact value you need, in the format you need it. Webequa’s calculator handles all the maths automatically so you can move between design, development, and print with confidence.
Try Webequa’s free hex calculator today and make sure your next project starts with exactly the right color.