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.

Hex Calculator

Enter Your Values

HEX
HEX

Your Results

Enter your values and tap Calculate to see the result.
Hexadecimal
--
Binary
--
Decimal
--
Octal
--

Quick navigation

How hex calculator works

Income tax calculator showing old vs new tax regime comparison results

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

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 ÷ 255

Step 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

  1. Enter a HEX code, or switch to RGB or HSL input mode.
  2. Type or paste your color value.
  3. Select which output formats you want to see.
  4. Click Calculate.
  5. Review the converted RGB, HSL, and CMYK values.
  6. 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 #3498DB written as #39D only work when both digits in each pair match.


Example Calculations

Example 1: Web Blue

Input:

ValueResult
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.8588

Step 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:

ValueResult
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.2353

Step 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 NameHex CodeRGB
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

FormatTypically Used For
HEXCSS, web design, design tools
RGBDigital screens, code, digital painting
HSLAdjusting color intuitively in CSS/design tools
CMYKCommercial 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

  1. Free and instant results
  2. Eliminates manual conversion errors
  3. Supports HEX, RGB, HSL, and CMYK in one place
  4. Works both forward and in reverse (RGB/HSL to HEX)
  5. Useful for web design, app design, and print preparation
  6. Saves time when matching brand colors across platforms
  7. Helps developers copy exact CSS-ready values
  8. Useful for building consistent color palettes
  9. Makes it easy to compare lightness and saturation between colors
  10. 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

  1. Forgetting the # symbol when pasting a hex code
  2. Using a 3-digit shorthand incorrectly for a color that isn’t a doubled pair
  3. Assuming CMYK output will exactly match a printed result
  4. Mixing up RGB order (entering values as BGR instead of RGB)
  5. Not checking whether a design tool expects percentages or 0–255 values for RGB
  6. Assuming HSL lightness and simple “brightness” are the same thing
  7. Copying a hex code with extra spaces or characters
  8. Using screen colors directly for print without checking CMYK
  9. Assuming all screens will render the exact same hex code identically
  10. Forgetting that black text on a dark background may still fail contrast even with a “readable” hex value

Tips for Accurate Results

  1. Always include all six digits of a hex code where possible, rather than relying on shorthand
  2. Double-check RGB values are within the 0–255 range before converting
  3. For print projects, treat the CMYK output as a starting point and confirm with a physical proof
  4. Use HSL when you want to create lighter or darker shades of the same color easily
  5. Keep a saved reference sheet of your brand’s exact hex codes to avoid drift over time
  6. When matching colors across tools, always copy the hex code rather than eyeballing the RGB sliders
  7. Check color contrast separately when designing for accessibility
  8. Calibrate your monitor periodically if color accuracy matters for your work
  9. Use the same color space (sRGB) across your design tools to avoid unexpected shifts
  10. 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


Scientific and Trade References


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.

FAQs

Hex Calculator – Frequently Asked Questions
Note: 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.
Scroll to Top