Skip to content
🛠️ToolsShed

Color Temperature Converter

Convert Kelvin color temperature to RGB and HEX. Visualize warm to cool light sources from candlelight to daylight.

K
HEX
#FFEFE1
RGB
255, 239, 225
Mired
179
Description
Cool White LED

Common Light Sources

Light SourceTemperature
Candlelight1,900K
Incandescent2,700K
Halogen3,200K
Fluorescent4,000K
Daylight5,600K
Blue Sky10,000K

About this tool

Color temperature, measured in Kelvin (K), describes the warmth or coolness of light emitted by different sources. From the orange glow of candlelight around 1,800 K to the cool blue tones of daylight at 6,500 K or higher, every light source has a distinctive color temperature that affects how we perceive colors and feel in a space. This converter transforms Kelvin values into RGB and hexadecimal color codes, making it easy to understand and replicate specific light colors in digital design, photography, or home lighting.

To use the Color Temperature Converter, simply enter a Kelvin value between 1,000 and 40,000 K, or select a preset such as candlelight, tungsten bulb, daylight, or cool fluorescent. The tool instantly calculates the corresponding RGB values and displays the exact hex color code, along with a visual color preview. This is invaluable for photographers adjusting white balance, designers matching ambient lighting in UI mockups, video producers planning color grading, or anyone curious about the science behind light and color perception.

The conversion follows the Planckian locus algorithm, which simulates how a black body radiates light at different temperatures—the same principle used in professional color correction software. While this tool provides excellent results for standard lighting scenarios, extreme temperatures (below 1,000 K or above 40,000 K) may produce less accurate colors since real light sources at those extremes behave differently. For fine-tuned color work in professional photography or cinematography, use this converter as a starting point and always verify with your final output device.

Frequently Asked Questions

Code Implementation

# Kelvin to RGB Color Temperature Conversion
# Algorithm by Tanner Helland (approximation)

import math

def clamp(value: float) -> int:
    return max(0, min(255, int(round(value))))

def kelvin_to_rgb(kelvin: float) -> tuple[int, int, int]:
    t = kelvin / 100.0
    if t <= 66:
        r = 255
        if t <= 1:
            g = 0
        else:
            g = clamp(99.4708025861 * math.log(t) - 161.1195681661)
        if t <= 19:
            b = 0
        else:
            b = clamp(138.5177312231 * math.log(t - 10) - 305.0447927307)
    else:
        r = clamp(329.698727446 * ((t - 60) ** -0.1332047592))
        g = clamp(288.1221695283 * ((t - 60) ** -0.0755148492))
        b = 255
    return r, g, b

def rgb_to_hex(r: int, g: int, b: int) -> str:
    return f"#{r:02X}{g:02X}{b:02X}"

def kelvin_to_mired(kelvin: float) -> int:
    return round(1_000_000 / kelvin)

# Examples
for k in [1900, 2700, 3200, 4000, 5600, 10000]:
    r, g, b = kelvin_to_rgb(k)
    print(f"{k}K: RGB({r},{g},{b}) = {rgb_to_hex(r,g,b)}, Mired={kelvin_to_mired(k)}")

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.