Apply gamma correction to a color
Reshape a color's midtones with a power curve: gamma 2.2 turns #3366cc into #07229c, values below 1 brighten midtones instead, and pure black and white never move. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Color
- #3366cc
- Gamma
- 2.2
- Hex
- #07229c
- Resistance (Ω)
- 7
- G
- 34
- B
- 156
Gamma correction reshapes how bright a color looks by raising every red, green, and blue channel to a power, instead of sliding lightness in HSL or mixing toward white. Values below one lift midtones; values above one pull midtones down; one leaves the swatch unchanged.
What gamma does to RGB channels
Start with a CSS hex color such as hash three three six six c c or the short form hash three six c. The parser expands three-digit codes, lowercases the digits, and converts each pair into red, green, and blue integers from zero to two hundred fifty-five. Each channel is normalized by dividing by two hundred fifty-five so the value sits on the unit interval.
The gamma exponent is then applied with ordinary floating-point power: the unit fraction raised to gamma. Multiplying back by two hundred fifty-five and rounding to the nearest integer yields the output channel, clamped to the legal zero-to-two-hundred-fifty-five range. Black stays black because zero raised to any positive power is zero.
White stays white because one raised to any power is one. The same exponent is applied independently to red, green, and blue, so relative channel balance can shift slightly compared with an HSL lightness move that freezes hue and saturation. That difference is intentional: gamma correction is the classic display and imaging power curve, not a perceptual lightness slider.
Alpha hex forms with four or eight digits are rejected because this contract is opaque RGB only.
What you enter and what you get back
Send two fields: color as a hex string and gamma as a finite number strictly greater than zero and at most ten. Each swatch includes role, hex, integer r g b, and a printable rgb string. Top-level hex, r, g, and b mirror the gamma-corrected result for one-line clients.
A short formula string documents the per-channel power rule for docs and support. Typical checks include applying gamma two point two to a mid blue, applying gamma zero point five to pure red to brighten midtones, confirming that gamma one returns the original hex, and rejecting gamma fifteen or a missing color. Wire the free browser form for quick previews, then call the identical contract from scripts when you need bulk token generation or continuous-integration checks.
Keep gamma inside the documented interval rather than relying on silent clamps — this tool fails loudly so design systems and rendering pipelines stay predictable across environments.
Where gamma correction earns its keep
Display and imaging pipelines often encode or decode luminance with a power curve near two point two; product teams that ship brand swatches still need a tiny, documented way to preview that same math on a single hex without opening a full image editor. Design-token authors generate nonlinear shade steps by sweeping gamma across a base color when HSL lighten or darken feels too linear for their brand book.
Accessibility reviewers explore darker or brighter companions of text and icon colors while keeping pure black and pure white fixed, then hand candidates to a contrast checker. Marketing and presentation tools produce softer or punchier campaign swatches from saturated logos when a simple percentage lighten washes hue. If you later need HSL lighten, darken by percent, mix two hex colors, or check WCAG contrast, treat those as separate search intents and landings rather than overloading this gamma page.
What you can do with it
Preview display gamma on brand hex
Apply a 2.2-style power curve to a single brand color and capture the resulting hex for docs, theme previews, and design reviews.
Nonlinear shade ramps for tokens
Sweep gamma across a base swatch to generate midtone steps that keep black and white fixed while reshaping everything in between.
FAQ
How does gamma correction change my hex color?
Each RGB channel c becomes round(255 × (c/255)^gamma). Black and white stay fixed; midtones brighten when gamma is below 1 and darken when gamma is above 1.
What gamma range is allowed?
Gamma must be a finite number in (0, 10].
Which hex formats are accepted?
Three-digit and six-digit CSS hex, with or without a leading hash. Alpha forms (#rgba / #rrggbbaa) and non-hex characters are rejected.
What does apply gamma correction cost?
The browser tool is free and runs locally.
What does gamma 2.2 do to #3366cc?
It darkens the midtones and returns #07229c, which is RGB 7, 34, 156. Each channel is divided by 255, raised to the power 2.2, multiplied by 255 again and rounded.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/color/gamma \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"color":"#3366cc","gamma":2.2}'const res = await fetch("https://api.kit.forhosting.com/color/gamma", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"color": "#3366cc",
"gamma": 2.2
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/color/gamma",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"color": "#3366cc",
"gamma": 2.2
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/color/gamma", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"color":"#3366cc","gamma":2.2}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"color":"#3366cc","gamma":2.2}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/color/gamma", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"color": "#3366cc",
"gamma": 2.2
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "color.gamma",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Designers, graphics engineers, and accessibility reviewers use a gamma exponent when they need a nonlinear brighten or darken that preserves pure black and pure white endpoints while reshaping everything in between. This tool accepts a CSS hex color and a gamma value in the open-closed interval from just above zero through ten, applies the classic per-channel formula out equals two hundred fifty-five times the normalized channel raised to gamma, and returns the corrected hex and RGB integers. Invalid hex strings and gamma outside the allowed range fail with a clear invalid_input error rather than silent clamping.
What gamma does to RGB channels
Everything between those endpoints moves along a power curve: gamma less than one bows the curve upward and brightens midtones; gamma greater than one bows it downward and darkens midtones; gamma equal to one is a pure identity.
Input contract, response shape, and validation
Color also accepts the aliases hex and base; gamma accepts g and exponent. Missing fields, non-hex characters, wrong lengths, NaN, Infinity, zero, negative gamma, and values above ten fail with invalid_input and are not charged. On success the response echoes the normalized six-digit color and the numeric gamma, then provides original and result swatches. Pricing for successful API calls is the published base of $0.002 per item; validation failures do not consume prepaid balance.
Where gamma correction earns its keep
Because this capability is a pure parse engine, API pricing is the published base of $0.002 per successful item and failed validation does not consume balance.
Integration use cases
CI golden checks for theme midtones
Assert that production tokens still match expected gamma-corrected RGB after palette edits, without opening an image editor.
Technical questions
What happens at gamma = 1?
Gamma 1 is identity: every channel is unchanged, so the result hex matches the normalized input hex.