Complex modulus calculator
The modulus of 3 + 4i is 5, its distance from the origin on the complex plane: enter the real and imaginary parts and get |z| and its square, never negative. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Real
- 3
- Imag
- 4
- Complex
- 3+4i
- Modulus
- 5
- Squared modulus
- 25
The modulus of a complex number is its distance from the origin on the Argand plane: for z equals a plus b i, |z| equals the square root of a squared plus b squared. Students meet this formula when converting rectangular form to polar form, engineers use it for impedance magnitude and signal amplitude, and graphics or control code needs a fast, deterministic |z| without pulling a computer-algebra system. This complex modulus calculator accepts the real and imaginary parts, returns the modulus, the squared modulus, a compact display string for the complex number, and a short formula you can show next to the answer.
What the complex modulus means geometrically and algebraically
A complex number z equals real plus imag times i can be drawn as a point or vector in the plane with horizontal coordinate real and vertical coordinate imag. The modulus |z| is exactly the Euclidean length of that vector: the straight-line distance from the origin to the point (real, imag). Algebraically that length is the non-negative square root of real squared plus imag squared, which is also written |a+bi| equals sqrt of a squared plus b squared.
Because squares erase sign, the numbers three plus four i, negative three plus four i, three minus four i, and negative three minus four i all share the same modulus five. When either part is zero the formula collapses sensibly: a pure real number has modulus equal to its absolute value, and a pure imaginary number bi has modulus equal to the absolute value of b. The zero complex number zero plus zero i has modulus zero and lies at the origin.
The modulus is never negative; it is zero only at the origin. In polar form z equals r times e to the i theta, the radius r is precisely this modulus, so computing |z| is the first step of rectangular-to-polar conversion.
Where the modulus of a complex number helps
Classrooms and tutoring platforms use a complex modulus calculator so learners can check |a+bi| for arbitrary coefficients without calculator-mode mistakes on signs or order of operations. Exam generators and LMS plugins need a deterministic oracle that rejects non-finite junk and never invents a negative length. Electrical engineering notebooks reduce impedance magnitude, phasor amplitude, and filter gain checks to a single |z| call when a full CAS would be overkill.
Signal-processing and control scripts compare energy or amplitude via the squared modulus without standing up heavy numeric libraries on the edge. Failed validation does not consume balance. Keep requests small, pin the rounded modulus in tests, and you get reproducible magnitudes for homework, LMS plugins, and edge workers without importing symbolic math infrastructure of your own.
What you can do with it
Classroom and homework checks
Let students submit real and imag for z=a+bi and verify |z| against textbook Pythagorean or polar-form methods.
Exam and LMS auto-grading
Mark complex modulus items with a deterministic oracle that returns the non-negative sqrt(a²+b²) and rejects non-finite input.
Engineering notebooks and phasors
Compute impedance magnitude or signal amplitude |a+bi| in scripts without pulling a full computer-algebra library.
FAQ
How do I compute the modulus of a complex number?
Send finite numbers real and imag for z = real + imag·i.
Is the modulus the same as the absolute value of a complex number?
Yes. |z|, modulus, magnitude, and absolute value of a complex number all mean the non-negative distance from the origin in the complex plane.
What if the imaginary part is zero?
Then z is a pure real number and |z| equals the ordinary absolute value of the real part. Pure imaginary numbers are handled the same way on the imag axis.
Does this calculator return the argument (angle)?
No. This capability returns only the modulus and related magnitude fields. Use a complex argument or polar-form tool if you also need the angle.
Why do 3 + 4i and −3 − 4i have the same modulus?
Squaring erases the signs, so 3 + 4i, −3 + 4i, 3 − 4i and −3 − 4i all have modulus 5. They are four points at the same distance from the origin, in different directions.
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/algebra/complex-modulus \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"real":3,"imag":4}'const res = await fetch("https://api.kit.forhosting.com/algebra/complex-modulus", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"real": 3,
"imag": 4
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/algebra/complex-modulus",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"real": 3,
"imag": 4
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/algebra/complex-modulus", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"real":3,"imag":4}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"real":3,"imag":4}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/algebra/complex-modulus", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"real": 3,
"imag": 4
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "algebra.complex_modulus",
"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
What the complex modulus means geometrically and algebraically
This endpoint focuses on that magnitude step and does not return the argument angle; pair it with an argument calculator if you need the full polar pair.
Input contract, response shape, and validation behaviour
Classic check: real equals three and imag equals four yields modulus five and squared modulus twenty-five, matching the Pythagorean triple. Real equals zero and imag equals negative seven yields modulus seven with complex string negative seven i. POST a JSON body with two required finite numbers: real, the real part of z, and imag, the imaginary part. Non-finite values, missing fields, empty strings, and non-numeric text fail with invalid_input naming the field, and those failures are not billed. On success the body echoes real and imag with stable twelve-decimal rounding, a complex display string such as three plus four i or five minus two i, the non-negative modulus, the squared modulus real squared plus imag squared, a boolean is_zero that is true only when both parts are zero, and a formula string restating |z| equals sqrt of real squared plus imag squared. Use squared_modulus when you only need to compare distances or avoid the square-root step; the modulus field is always the non-negative root and is the value textbooks label |z|.
Technical questions
What does the complex modulus calculator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.