Ohm's law calculator
Give any two of voltage, current, resistance and power and the other two are worked out: 12 V at 2 A means 6 ohms and 24 watts. All six pairings are covered, from sizing a resistor to checking how much heat a part must handle. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Voltage (V)
- 12
- Current (A)
- 2
- Resistance (Ω)
- 6
- Power (W)
- 24
- Known values
- i, v
Takes exactly two of v (volts), i (amps), r (ohms) and p (watts) and solves for the remaining two using Ohm's law V=I*R and the power relation P=V*I, returning all four values plus the pair you supplied.
Ohm's law and power from any two values
The calculator works from the two identities V = I*R (Ohm's law) and P = V*I (electrical power), which together let any two of the four quantities determine the other two. You provide exactly two of v, i, r and p, and the tool solves the remaining pair, returning an object with all four fields v, i, r and p plus given, an alphabetically sorted list of the two inputs you supplied.
The reference example passes v 12 and i 2 and returns r 6 and p 24, with given set to i and v, showing a 12-volt, 2-amp load resolving to 6 ohms and 24 watts. Because it always echoes the full set, downstream code never has to remember which two it sent; it can read every quantity of the circuit from one consistent response.
The six input combinations
There are six ways to choose two of the four unknowns, and each has its own closed-form solution. Given v and i: r = v/i and p = v*i. Given v and r: i = v/r and p = v*v/r.
Given v and p: i = p/v and r = v*v/p. Given i and r: v = i*r and p = i*i*r. Given i and p: v = p/i and r = p/(i*i).
Given r and p: i = sqrt(p/r) and v = i*r. The square-root branch for the resistance-and-power case is the only one that is not a simple product or quotient, and it works because power dissipated in a resistor is I squared times R. Every branch is pure arithmetic on your two inputs, so the result depends only on the numbers you send, never on any hidden state.
What you can do with it
Electronics design
Size a series resistor from a supply voltage and target current, or check the power a component must dissipate before choosing its rating.
LED and load calculations
From a known voltage and current, read back resistance and wattage to pick a resistor and confirm it stays within safe power limits.
Teaching and lab work
Demonstrate how V, I, R and P interrelate, using the deterministic 12 V / 2 A example returning 6 ohms and 24 watts as a reference answer.
FAQ
How many values do I provide?
Exactly two of v, i, r and p. The tool solves the remaining two and returns all four plus the given pair.
What do v 12 and i 2 return?
r 6 and p 24, with given set to i and v, following r = v/i and p = v*i.
Which combinations are supported?
All six pairings of v, i, r and p, including r and p, which solves i = sqrt(p/r) then v = i*r.
How do I check the power a resistor has to handle?
Enter the voltage across it and its resistance. Power is the voltage squared divided by the resistance, so you can compare the result with the resistor's rating before you pick one.
Can I enter zero or a negative value?
No. Each of the two values must be greater than zero, so zero and negative numbers are refused. That keeps every division and the square root in the formulas meaningful.
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/dev/ohm-law \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"v":12,"i":2}'const res = await fetch("https://api.kit.forhosting.com/dev/ohm-law", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"v": 12,
"i": 2
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/dev/ohm-law",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"v": 12,
"i": 2
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/dev/ohm-law", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"v":12,"i":2}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"v":12,"i":2}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/dev/ohm-law", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"v": 12,
"i": 2
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "dev.ohm_law",
"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
Validation, precision and determinism
Each supplied value must be a finite number strictly greater than zero, so zero, negatives, NaN and non-numbers are rejected with a message identifying the field, which also keeps the sqrt and division branches well defined. The decimals parameter is an integer from 0 to 10 and defaults to 6; a value outside that range is rejected rather than clamped. The tool counts how many of v, i, r and p are present and requires exactly two; sending one, three or four throws a typed invalid_input error naming the rule.
Technical questions
Can I use negative or zero values?
No. Each supplied value must be a finite number greater than zero, otherwise a typed invalid_input error is returned.
Is the browser tool free?
Yes, the widget is free (tier A). The API runs on prepaid KIT balance from $0.002 and charges only successful tasks.