LED current calculator
A 5 V USB rail, a red LED with a 2 V drop and a 150 Ω resistor give 0.02 A through the diode, with 3 V across the resistor. Enter supply voltage, forward voltage and resistance to check an indicator before you solder it. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Supply voltage
- 5
- Forward voltage
- 2
- Resistance
- 150
- Voltage drop
- 3
- Current
- 0.02
This LED current calculator returns the current through a series LED circuit in amperes from three SI quantities: DC supply voltage in volts, LED forward voltage drop in volts, and series resistance in ohms. Ohm's law on the leftover headroom gives I equals supply minus forward voltage, divided by R, so a larger resistor or a smaller voltage difference each reduce the current that actually flows through the diode.
What I = (Vs − Vf)/R means and which voltages to enter
Model the branch as a DC supply, a single LED (or a string treated as one total forward drop), and one series resistor that takes the leftover headroom. Kirchhoff's voltage law around that loop says the supply equals the LED forward voltage plus the resistor drop, so the resistor sees Vs minus Vf. Ohm's law then gives the current that actually flows: I equals that headroom divided by R.
All three inputs are SI: supply and forward voltages in volts, resistance in ohms, current in amperes. Typical indicator work uses a five-volt USB rail, a two-volt red LED, and one hundred fifty ohms, which yields twenty milliamps — read current as 0.02 amperes, not a milliamp integer. Blue and white emitters sit closer to three volts; infrared parts sit lower.
Always take forward voltage from the datasheet at the current you expect, not a colour rule of thumb, because the diode curve is not a hard clamp. Current falls if you raise R or shrink the headroom, and it rises if you drop R or raise the rail. That inverse dependence on R is why a vanishing resistor is not a current-limited LED in this model — the formula diverges at zero ohms — so the engine refuses a zero or negative series resistance instead of emitting infinity.
A supply that sits strictly below the forward drop cannot forward-bias the LED here, so that case is refused rather than returning a negative current that no physical diode would carry. Equal voltages are allowed and return zero amperes: the diode sits at the edge of conduction with no resistor drop.
Where an LED current check helps
Classrooms and tutoring platforms use an LED current calculator so learners can check ampere results for arbitrary Vs, Vf, and R without unit-conversion slips by hand. Exam-prep generators need a deterministic oracle that marks wrong the case of a zero resistor or a supply below the forward drop instead of silently returning infinity or a negative current that a buggy grader might treat as success. Firmware and panel teams verify that a chosen dropping resistor actually keeps an indicator inside its milliamp window before they solder a board.
Failed validation does not consume balance. Keep requests in SI units end to end, convert milliamps only after you read current, and pin the ampere value in tests so homework checks, LMS plugins, and edge workers stay reproducible without standing up a circuit-simulation deck of your own. PWM average current, constant-current drivers, multi-string ballast networks, and temperature-dependent Vf remain outside the ideal DC loop, so treat the number as the classic textbook baseline rather than a transient simulation.
This product does not size the resistor from a target current — that inverse job is a different search and a different contract.
What you can do with it
Breadboard and Arduino current checks
Makers enter a five-volt rail, a two-volt red LED and one hundred fifty ohms to confirm the branch sits at twenty milliamps before wiring a status light.
Panel and appliance pilot lamps
Industrial designers verify current through twelve or twenty-four volt panel indicators from datasheet Vf and a chosen dropping resistor so lamps neither burn out nor run dim.
FAQ
What happens if supply voltage is below the LED forward drop?
Vs below Vf cannot forward-bias the LED in this DC model, so the engine names both voltages and does not return a negative current.
Which forward voltage should I enter for my LED?
Take it from the datasheet at the current you expect, not from a colour rule of thumb. As a rough guide, red parts sit near 2 V, blue and white closer to 3 V, and infrared lower.
Can the calculator choose the resistor for me?
No. It works out the current for a resistor you already have. To aim for a target current, try different values: a larger resistor lowers the current and a smaller one raises it.
What happens if the supply equals the forward voltage?
The result is zero amperes. The diode sits at the edge of conduction, with no voltage left across the resistor to push current through the branch.
Why is a zero-ohm resistor refused?
Because the current is the leftover voltage divided by the resistance, and dividing by zero gives no finite answer. Without a series resistor nothing limits the LED current, so the calculator asks for a positive value.
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/phys/led \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"supply_voltage":5,"forward_voltage":2,"resistance":150}'const res = await fetch("https://api.kit.forhosting.com/phys/led", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"supply_voltage": 5,
"forward_voltage": 2,
"resistance": 150
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/phys/led",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"supply_voltage": 5,
"forward_voltage": 2,
"resistance": 150
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/phys/led", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"supply_voltage":5,"forward_voltage":2,"resistance":150}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"supply_voltage":5,"forward_voltage":2,"resistance":150}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/phys/led", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"supply_voltage": 5,
"forward_voltage": 2,
"resistance": 150
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "phys.led",
"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.
Limits
max_abs_voltage | 1000000 |
max_abs_resistance | 1000000000000 |
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
Input contract, response shape, and error behaviour
Resistance must be strictly greater than zero: both a zero-ohm path and a negative-ohm path fail with a message that a series resistance of zero cannot limit LED current, matching the product promise that the one-over-R singularity never masquerades as a finite answer. Magnitude ceilings keep pathological inputs from overflowing isolate arithmetic while still covering laboratory rails and ordinary kilo-ohm dropping resistors. POST a JSON body with three required finite numbers: supply_voltage, the DC rail in volts; forward_voltage, the LED drop in volts at the operating point; and resistance, the series ohms. Each field may arrive as a JSON number or as a numeric string; aliases Vs, supply, voltage and vcc, Vf, led_voltage, v_f and vled, and R, series_resistance, resistor and ohms are accepted so notebooks and CAD exports map without renaming columns. Missing fields, empty strings, and non-finite values fail with invalid_input naming the field. On success the body echoes the three inputs, reports current in amperes, voltage_drop as Vs minus Vf, and includes formula I equals open parenthesis Vs minus Vf close parenthesis over R, method led_series_current, and a units object documenting amperes, volts, and ohms. Pair the response with your own resistor-sizing step if you next need to pick R from a target current; this endpoint computes current from a known resistor only and does not emit BOM wattage, E-series rounding, or plots.
Integration use cases
Classroom and homework oracles
Electronics courses pin deterministic JSON for I equals (Vs minus Vf) over R drills, including intentional zero-ohm and supply-below-Vf cases that must fail with invalid_input.
Technical questions
How is LED current computed from supply, forward voltage, and resistance?
Send finite numbers supply_voltage (V), forward_voltage (V), and resistance (ohm). The API returns I = (Vs − Vf) / R in amperes, plus the echoed inputs, voltage drop, formula, and SI units.
What happens if series resistance is zero?
The task fails with invalid_input. A series resistance of zero cannot limit LED current, so the engine rejects it and does not bill the call. Negative ohms fail the same way.
What does a successful LED current response contain?
Echoed supply_voltage, forward_voltage, and resistance, voltage_drop in volts, current in amperes, formula I = (Vs − Vf) / R, method led_series_current, and a units object for A, V, and ohm.
What does the LED current calculator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.