Complex number to polar form
Describe a complex number by distance and direction instead of coordinates: 3 + 4i sits at magnitude 5, and 2i points straight up at 90°, with the angle also given in radians. Below the real axis the angle comes out negative. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Real
- 1
- Imag
- 1
- Magnitude
- 1.4142135624
- Angle rad
- 0.7853981634
- Angle deg
- 45
The complex number to polar form converter takes a complex number given by its real part and imaginary part and returns its polar form: the magnitude, which is the distance from the origin in the complex plane, and the angle (or argument) measured counterclockwise from the positive real axis, reported in both radians and degrees. The angle is computed with the two-argument arctangent, so it always lands in the correct quadrant, and a negative imaginary part yields a negative angle. Both parts must be finite numbers; anything else is rejected with a clear validation error.
From a + bi to magnitude and angle
A complex number written as a + bi locates a point in the complex plane: the real part a measures how far along the horizontal axis it sits, and the imaginary part b how far up or down. Polar form describes the very same number by a distance and a direction instead. The distance is the magnitude, often written r or |z|, computed as the hypotenuse of the right triangle formed by the two parts, so 3 + 4i has magnitude exactly 5.
The direction is the angle, often written theta or arg(z), measured counterclockwise from the positive real axis, so a purely imaginary number like 2i sits at pi/2 radians, which is 90 degrees.
Sending the two parts to this complex number to polar form converter returns the magnitude and the angle in a single call, and once you have them you can write the number as r(cos theta + i sin theta) or compactly as r times e to the i theta, which is the form that makes multiplication, division, powers, and roots of complex numbers simple.
Because the magnitude comes from a hypotenuse calculation rather than a naive square root of summed squares, the result avoids overflow even when the parts are very large finite numbers.
Why the angle uses atan2 and comes in two units
A plain arctangent of the imaginary part divided by the real part cannot distinguish a number in the first quadrant from one in the third, because the ratio is identical, and it breaks entirely when the real part is zero. The two-argument arctangent, atan2, inspects the signs of both parts, so the angle always points into the correct quadrant and is defined for every input except the exact zero.
The result lies in the interval from negative pi to positive pi radians: positive angles mean the number sits above the real axis, negative angles mean below, exactly pi means the negative real axis, and zero means the positive real axis. This converter reports the angle twice, in radians and in degrees, because different consumers want different units: radians feed directly into the trigonometric and exponential functions of every programming language and into Euler's formula, while degrees are what most people read on homework, in textbooks, and in engineering specifications.
Computing both in one call saves you a conversion step and a rounding ambiguity, and both values are rounded to twelve decimal places so results compare byte-identically across machines and JavaScript engines.
Validation, determinism, and where it fits
Each part must be a finite number. The zero complex number is a deliberate special case: its magnitude is zero and its angle is mathematically undefined, so the converter returns an angle of zero in both units by convention rather than failing, which keeps pipelines total and predictable while documenting the choice. Typical callers are electrical engineering tools converting impedance between rectangular and phasor form, signal processing code moving between Cartesian and magnitude-phase representations, control systems doing frequency response analysis, and students checking complex arithmetic homework.
What you can do with it
Electrical engineering and phasors
Convert an impedance given as resistance plus reactance (R + jX) into magnitude and phase angle in degrees for AC circuit analysis.
Signal processing
Move a complex FFT bin or filter coefficient from real/imaginary form into magnitude and phase in radians for spectral analysis.
Math homework and teaching
Check the polar form of a complex number before applying De Moivre's theorem for powers and roots, with the angle shown in both units.
FAQ
What does it cost?
The same conversion is free to run in your browser on this page.
What exactly is returned?
The magnitude (distance from the origin), the angle in radians in (-pi, pi], the same angle in degrees in (-180, 180], and the echoed real and imaginary parts.
Why both radians and degrees?
Radians feed directly into trig functions, exponentials, and Euler's formula; degrees are what most people read in textbooks and engineering documents. One call returns both, with no conversion step on your side.
What happens for 0 + 0i?
The magnitude is 0 and the angle is mathematically undefined, so the converter returns an angle of 0 in both units by convention instead of failing.
Which inputs are rejected?
Anything that is not a finite number: missing fields, null, booleans, arrays, empty or non-numeric strings, NaN, and Infinity. Numeric strings like "3.5" are accepted.
Is the angle always in the correct quadrant?
Yes. It is computed with the two-argument arctangent atan2(imag, real), which uses the signs of both parts to place the angle in the right quadrant.
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/math/complex-number-to-polar-form \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"real":1,"imag":1}'const res = await fetch("https://api.kit.forhosting.com/math/complex-number-to-polar-form", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"real": 1,
"imag": 1
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/complex-number-to-polar-form",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"real": 1,
"imag": 1
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/complex-number-to-polar-form", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"real":1,"imag":1}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"real":1,"imag":1}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/complex-number-to-polar-form", 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": 1,
"imag": 1
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.complex_number_to_polar_form",
"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
The same conversion runs free in your browser on this page, and the identical code serves the paid API at $0.002 per request.
Validation, determinism, and where it fits
The endpoint accepts JSON numbers and numeric strings such as "3.5" or "-2", which is convenient when values arrive as web form fields, but it rejects nulls, empty strings, booleans, arrays, the text NaN, and anything infinite, answering with an invalid input error that names the offending field instead of silently producing a meaningless angle. It runs on the edge in milliseconds, keeps nothing after the response, and costs $0.002 per request through the API while remaining free to use interactively in the browser.