How to Make a Hex Color Darker

Darkening a hex color is something every web developer and designer runs into — whether you're creating a pressed button state, building a dark mode palette, or just need a richer version of a brand color. If you've got a hex code like #6db3f2 and need it darker, you're in the right place.

The concept is the mirror image of lightening: instead of blending toward white, you blend toward black (#000000). Every RGB channel gets pulled closer to zero, producing a shade — a deeper, more saturated version of the original color.

Here are three methods, ranked from "I want to understand it" to "just give me the result."

Method 1 — Proportional Blending Toward Black

This is the mathematically correct way to darken a hex color while preserving its hue and character.

The Formula

For each RGB channel:

new_value = old_value × (1 − percentage)

Where percentage is how much darker you want to go (0.2 = 20% darker, 0.5 = 50% darker).

Worked Example

Starting with #6db3f2:

R: 6d → 109. Darken 25%: 109 × 0.75 = 8252

G: b3 → 179. Darken 25%: 179 × 0.75 = 13486

B: f2 → 242. Darken 25%: 242 × 0.75 = 182b6

Result: #5286b6 — a clearly darker blue that keeps the same cool hue.

Here's what that looks like:

#6db3f2 original
#5286b6 25% darker

Why Multiply Instead of Subtract?

Subtracting a flat value (like 40 from each channel) can push low channels below zero and distort the color balance. Multiplying by a factor scales proportionally — channels that are already dark don't go negative, and the relative balance between R, G, and B stays intact. This is how professional color systems (Sass darken(), Figma's "Shade" feature) work under the hood.

Method 2 — HSL Lightness Reduction

Just like lightening, the HSL model gives you a single dial to turn.

Steps

  1. Convert hex to HSL. #6db3f2 → H ≈ 210°, S ≈ 84%, L ≈ 69%.
  2. Decrease the L (Lightness) value. Drop from 69% to 45% or 30%.
  3. Convert back to hex.

This is especially convenient in CSS where you can write colors in hsl() notation directly and tweak the lightness with custom properties or calc().

A CSS Custom Properties Trick

:root {
  --brand-h: 210;
  --brand-s: 84%;
  --brand-l: 69%;

  --brand:      hsl(var(--brand-h) var(--brand-s) var(--brand-l));
  --brand-dark: hsl(var(--brand-h) var(--brand-s) calc(var(--brand-l) - 20%));
}

.btn        { background: var(--brand); }
.btn:hover  { background: var(--brand-dark); }
.btn:active { background: hsl(var(--brand-h) var(--brand-s) calc(var(--brand-l) - 35%)); }

This pattern lets you derive all shades from a single set of HSL tokens — change the base lightness, and every variant updates automatically.

Method 3 — Use a Free Shade Generator

When you need multiple darkness levels at once — say for a full design token scale from 50 to 950 — manually computing each step is impractical.

HexTints generates every shade (and tint) of any hex color in one click. Enter your base color, and you get a complete palette from near-white tints all the way down to near-black shades. Each value is calculated with proportional blending, each swatch is click-to-copy, and the entire output is ready to drop into your codebase.

Design systems like Tailwind ship pre-built scales with 11 steps per hue. HexTints lets you generate the same kind of scale for any custom brand color in seconds.

When You Need Darker Hex Colors (Real-World Scenarios)

Dark mode palettes: Don't just invert your light theme. Take your brand colors and generate 3–4 darker shades that work against dark backgrounds. This preserves brand identity while ensuring readability in dark UI contexts.

Button pressed/active states: The convention is: default → lighter on hover → darker on press. A 15–20% darker shade of your button color creates the "pressed in" affordance users expect.

Text on colored backgrounds: When your background is a medium-brightness color, you need dark variants of that same hue for text. This creates contrast while maintaining a monochromatic, cohesive palette.

Borders and shadows: Subtle 5–10% darker shades of a surface color make excellent border colors. They add depth and definition without introducing new hues.

Gradient endpoints: A gradient from your base color to a 30–40% darker shade creates a natural depth effect — commonly used in hero sections, cards, and navigation bars.

Common Mistakes When Darkening Hex Colors

Subtracting a flat number: #6db3f2 minus #404040 does not produce a good result. The channels subtract unevenly, and some may clip at zero. Always multiply by a factor instead.

Over-darkening and losing hue: Below about 10% lightness in HSL, most colors start looking indistinguishable from black. If you need very dark colors that retain a visible hue, consider capping your darkening at 80–85% of the original value.

Darkening in sRGB vs. perceptual spaces: sRGB (what hex codes use) isn't perceptually linear. A 20% mathematical darkening doesn't always look like 20% darker to human eyes. For high-fidelity work, consider using OKLCH or Lab* color spaces. For everyday web work, sRGB is fine.

Frequently Asked Questions