# LED Resistor Calculator

> Computes the current-limiting series resistor for one or more LEDs in series from the supply voltage, LED forward voltage and desired current, then picks the nearest E12 and E24 preferred values, a safe (rounded-up) E24 value and the resistor power rating.

- Calculator id: `led-resistor` · Category: Engineering & Automotive (`engineering`) · Tool name: `calculate_led_series_resistor`
- Canonical page: https://tttkmbb.com/engineering/led-resistor · This document: https://tttkmbb.com/engineering/led-resistor.md · JSON definition: https://tttkmbb.com/engineering/led-resistor.json

## Purpose

Computes the current-limiting series resistor for one or more LEDs in series from the supply voltage, LED forward voltage and desired current, then picks the nearest E12 and E24 preferred values, a safe (rounded-up) E24 value and the resistor power rating.

**Use when:** You are wiring an LED (or a string of LEDs in series) to a DC supply and need the resistor value, a standard part value and its wattage.

**Do not use when:** LEDs are in parallel (each branch needs its own resistor), you drive high-power LEDs with a constant-current driver, or you only need Ohm's law (use ohms-law).

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `supply_voltage_v` | number | V | required | DC supply voltage in volts (e.g. 5, 9, 12, 24). (> 0, max 1000) |
| `led_forward_voltage_v` | number | V | optional, default 2 | Forward voltage drop of one LED at the design current: red/yellow ≈ 1.8–2.2 V, green ≈ 2.0–3.2 V, blue/white ≈ 3.0–3.6 V. (> 0, max 50) |
| `led_current_ma` | number | mA | optional, default 20 | Desired forward current in milliamperes; 20 mA is typical for 5 mm indicator LEDs. (> 0, max 5000) |
| `leds_in_series` | integer |  | optional, default 1 | Number of LEDs connected in series in one string. (min 1, max 100) |

## Output

| Field | Type | Unit | Description |
| --- | --- | --- | --- |
| `total_led_voltage_v` | number | V | leds_in_series × led_forward_voltage_v. |
| `resistor_voltage_v` | number | V | supply_voltage_v − total_led_voltage_v. |
| `resistor_ohm` | number | Ω | R = resistor_voltage_v / led_current_a. |
| `nearest_e12_ohm` | number | Ω | Closest value in the E12 (10 %) preferred-number series. |
| `nearest_e24_ohm` | number | Ω | Closest value in the E24 (5 %) preferred-number series. |
| `recommended_resistor_ohm` | number | Ω | Smallest E24 value at or above the exact value, so the LED current does not exceed the target. |
| `current_with_recommended_ma` | number | mA | resistor_voltage_v / recommended_resistor_ohm × 1000. |
| `resistor_power_w` | number | W | Power dissipated in the resistor: resistor_voltage_v × led_current_a. |
| `recommended_power_rating_w` | number | W | Smallest standard rating (1/8, 1/4, 1/2, 1, 2, 3, 5 W …) at or above twice the dissipated power. |

## Formula

`resistor_ohm = (supply_voltage_v − leds_in_series × led_forward_voltage_v) / (led_current_ma / 1000); resistor_power_w = (supply_voltage_v − leds_in_series × led_forward_voltage_v) × led_current_ma / 1000; rating ≥ 2 × resistor_power_w`

Standard values follow IEC 60063 E12/E24 series. The 2× power margin is the usual derating rule so the resistor runs cool; LED forward voltage varies ±10 % between parts and with temperature, so the actual current differs slightly.

## Data Sources

- Wikipedia – LED circuit — https://en.wikipedia.org/wiki/LED_circuit (reference, retrieved 2026-09-24)
- Wikipedia – E series of preferred numbers (IEC 60063) — https://en.wikipedia.org/wiki/E_series_of_preferred_numbers (reference, retrieved 2026-09-24)

Data freshness: `static`. Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output.

## API

- `GET https://tttkmbb.com/api/v1/calculate/led-resistor?supply_voltage_v=…`
- `POST https://tttkmbb.com/api/v1/calculate/led-resistor` with JSON body `{"inputs": {…}}`
- Response: unified envelope (`success`, `request`, `result.values`, `result.units`, `sources`, `freshness`, `timestamp`, `next_actions`, `links`); see https://tttkmbb.com/docs/response-format.md
- Schema: https://tttkmbb.com/api/v1/calculators/led-resistor · OpenAPI operationId `calculate_led_series_resistor` in https://tttkmbb.com/openapi.json
- Authentication: none. Rate limit: fair use, see https://tttkmbb.com/docs/rate-limits.md.

## MCP

- Server: `https://tttkmbb.com/mcp` (Streamable HTTP, JSON-RPC 2.0, no auth)
- Tool:  `run_calculator` with `{"calculator_id": "led-resistor", "inputs": {…}}`

## Example

- 12 V supply, 2 V LED, 20 mA: inputs `{"supply_voltage_v":12,"led_forward_voltage_v":2,"led_current_ma":20}` → `{"total_led_voltage_v":2,"resistor_voltage_v":10,"resistor_ohm":500,"nearest_e12_ohm":470,"nearest_e24_ohm":510,"recommended_resistor_ohm":510,"current_with_recommended_ma":19.61,"resistor_power_w":0.2,"recommended_power_rating_w":0.5}`
- Three 3.2 V white LEDs in series on 12 V at 20 mA: inputs `{"supply_voltage_v":12,"led_forward_voltage_v":3.2,"led_current_ma":20,"leds_in_series":3}` → `{"total_led_voltage_v":9.6,"resistor_ohm":120,"nearest_e12_ohm":120,"recommended_resistor_ohm":120,"current_with_recommended_ma":20,"resistor_power_w":0.048,"recommended_power_rating_w":0.125}`

```
GET https://tttkmbb.com/api/v1/calculate/led-resistor?supply_voltage_v=12&led_forward_voltage_v=2&led_current_ma=20
```

## Limitations

LEDs are in parallel (each branch needs its own resistor), you drive high-power LEDs with a constant-current driver, or you only need Ohm's law (use ohms-law). Standard values follow IEC 60063 E12/E24 series. The 2× power margin is the usual derating rule so the resistor runs cool; LED forward voltage varies ±10 % between parts and with temperature, so the actual current differs slightly. All values are computed from the formula above; no measurement or live data is involved.

## FAQ

**Why round the resistor up rather than to the nearest value?**

A larger resistor lowers the current slightly (dimmer but safe); a smaller one raises it above the LED rating. The nearest values are reported for reference, the recommended value is the next E24 value at or above the exact result.

**What if the supply voltage barely exceeds the LED voltage?**

The resistor becomes very small and the current very sensitive to voltage tolerance. Keep at least 2–3 V across the resistor, or use a constant-current driver.

**How many LEDs can I put in series?**

Their forward voltages must sum to less than the supply voltage; the calculator returns an error otherwise.

## Related

- [Ohm's Law Calculator](https://tttkmbb.com/physics/ohms-law.md) — The same V = I·R relation for any resistor.
- [Resistor Color Code Calculator](https://tttkmbb.com/engineering/resistor-color-code.md) — Read or produce the colour bands of the chosen resistor.
- [Voltage Divider Calculator](https://tttkmbb.com/engineering/voltage-divider.md) — Derive a lower voltage with two resistors.
