Skip to content
RFrftools.io
Convert

Rectangular ↔ Polar Complex Number Converter

Convert complex numbers between rectangular (a + jb) and polar (r∠θ) form. Quadrant-correct via atan2, with degrees, radians, and 0–360° wrapped angle. For impedance, S-parameters, and phasor arithmetic.

Loading calculator...

Formula

r=a2+b2,θ=atan2(b,a)a=rcosθ,b=rsinθr = \sqrt{a^{2} + b^{2}},\quad \theta = \operatorname{atan2}(b,\,a) \qquad a = r\cos\theta,\quad b = r\sin\theta

Reference: Standard complex-plane identities; Touchstone MA/RI conventions

aReal part (resistance R for impedance)
bImaginary part (reactance X for impedance)
rMagnitude / modulus
θPhase angle / argument (° or rad)

How It Works

Every complex quantity in electronics — an impedance, an S-parameter, a phasor voltage — has two equivalent descriptions. Rectangular form a+jba + jb names the point by its coordinates in the complex plane. Polar form rθr\angle\theta names it by distance from the origin and angle from the positive real axis. The two carry identical information; which one you want depends on the operation. Addition and subtraction are trivial in rectangular form because the components add independently. Multiplication, division, and raising to a power are trivial in polar form because magnitudes multiply and angles add.

The conversion out of rectangular form is r=a2+b2r = \sqrt{a^2 + b^2} and θ=atan2(b,a)\theta = \operatorname{atan2}(b, a). The magnitude is just the Pythagorean distance and is never controversial. The angle is where nearly every mistake in this conversion lives, because the naive expression θ=arctan(b/a)\theta = \arctan(b/a) is wrong for half the plane. A single-argument arctangent returns values only in 90°-90° to +90°+90°, and the ratio b/ab/a discards the individual signs: 3j4-3 - j4 and 3+j43 + j4 produce the same ratio and therefore the same answer, even though they point in opposite directions. The two-argument form atan2 takes bb and aa separately, inspects both signs, and returns the true angle over the full 180°-180° to +180°+180° range.

The reverse conversion is the definition of polar coordinates: a=rcosθa = r\cos\theta and b=rsinθb = r\sin\theta. It has no ambiguity, but it does have a convention to respect — the magnitude is taken as non-negative. A negative rr describes the same vector as r(θ+180°)|r|\angle(\theta + 180°), and while the arithmetic still works, most instruments and file formats assume r0r \ge 0 and will misinterpret it.

In RF work the practical stakes are concrete. An impedance Z=R+jXZ = R + jX in polar form is Zθ|Z|\angle\theta, where θ>0\theta > 0 means inductive and θ<0\theta < 0 means capacitive. A reflection coefficient stored in Touchstone MA format is magnitude and degrees; in RI format it is the rectangular pair. Getting the quadrant wrong flips an inductive load into a capacitive one, which sends a matching network in exactly the wrong direction.

Worked Example

Given: z=3+j4z = 3 + j4, and separately 553.13°5\angle 53.13° Step 1: Magnitude from the rectangular pair r=a2+b2=32+42=9+16=25=5r = \sqrt{a^2 + b^2} = \sqrt{3^2 + 4^2} = \sqrt{9 + 16} = \sqrt{25} = 5 Step 2: Angle with atan2 θ=atan2(4,3)=0.9272952180016122\theta = \operatorname{atan2}(4, 3) = 0.9272952180016122 rad

Converting to degrees: 0.9272952180016122×180π=53.13010235415598°0.9272952180016122 \times \frac{180}{\pi} = 53.13010235415598°

Both aa and bb are positive, so the point is in quadrant I and the 00360°360° form is the same value, 53.13010235415598°53.13010235415598°.

Step 3: Back the other way a=rcosθ=5×cos(53.13010235415598°)=3a = r\cos\theta = 5 \times \cos(53.13010235415598°) = 3 b=rsinθ=5×sin(53.13010235415598°)=4b = r\sin\theta = 5 \times \sin(53.13010235415598°) = 4

The round trip recovers the original pair exactly, which is the check worth running whenever you suspect a quadrant problem.

Step 4: Why the quadrant matters

Take z=3j4z = -3 - j4 instead. The ratio b/a=4/3=1.333b/a = -4/-3 = 1.333 is identical to the ratio for 3+j43 + j4, so arctan(b/a)\arctan(b/a) returns 53.13°53.13° for both — pointing into quadrant I when the vector is actually in quadrant III. atan2 sees that both arguments are negative and returns 126.86989764584402°-126.86989764584402°, equivalently 233.13010235415598°233.13010235415598° in the 00360°360° form.

Result: 3+j4=553.1301°3 + j4 = 5\angle 53.1301°, and 3j4=5126.8699°-3 - j4 = 5\angle -126.8699° — same magnitude, opposite direction.

Practical Tips

  • Use polar form for cascaded multiplication (impedance transformations, chained S-parameters) and rectangular form for anything additive (series impedances, superposed phasors) — converting at the right moment removes most of the arithmetic
  • For an impedance, read the sign of the angle first: positive is inductive, negative is capacitive, zero is purely resistive. It tells you which way to move before you compute anything
  • When reading Touchstone files, confirm the format line: MA is magnitude and degrees, DB is magnitude in dB and degrees, RI is the rectangular pair. Mistaking DB for MA gives a magnitude that is wrong by a logarithm
  • Round-trip any suspicious conversion — convert to polar, convert straight back, and compare against the original. A quadrant error shows up immediately as a sign flip
  • Keep full precision on the angle when chaining conversions. Rounding 53.13010235 degrees to 53.1 introduces a 0.02 percent magnitude error after just a few cascaded multiplications

Common Mistakes

  • Using arctan(b/a) instead of atan2(b, a) — this collapses quadrant II onto quadrant IV and quadrant III onto quadrant I, producing a silent 180-degree error that inverts an impedance from inductive to capacitive
  • Mixing degrees and radians in the same calculation — trigonometric library functions almost always take radians, so a value in degrees must be multiplied by pi/180 before it reaches cos or sin
  • Assuming the angle range without checking — atan2 returns -180 to +180 degrees, while many VNAs and Touchstone readers present 0 to 360; the two differ by exactly 360 degrees for negative angles and comparing them directly gives a spurious mismatch
  • Entering a negative magnitude in polar form — r is defined as non-negative, and a negative value silently rotates the vector by 180 degrees relative to what downstream tools expect
  • Averaging angles across a wrap point — the mean of 179 degrees and -179 degrees is 0 degrees by arithmetic but 180 degrees in reality; unwrap the phase before any averaging or interpolation

Frequently Asked Questions

arctan takes one argument, the ratio b/a, and can only return an angle between -90 and +90 degrees. atan2 takes b and a as separate arguments, so it can see their individual signs and return the correct angle anywhere in the full -180 to +180 degree range. Since the ratio b/a is identical for a point and its opposite, arctan cannot distinguish them and atan2 can.
Treat resistance as the real part and reactance as the imaginary part. For Z = 50 - j25 ohms the magnitude is sqrt(50^2 + 25^2) = 55.90 ohms and the angle is atan2(-25, 50) = -26.57 degrees. The negative angle confirms the load is capacitive.
Because it is using single-argument arctan on the ratio. Both cases give b/a = 1.333, so the ratio alone cannot tell them apart. The correct answers are +53.13 degrees and -126.87 degrees respectively — same magnitude of 5, opposite directions in the plane.
Use -180 to 180 for anything where the sign carries meaning, such as impedance phase, because the sign immediately distinguishes inductive from capacitive. Use 0 to 360 when matching an instrument display or file format that uses that convention. This calculator reports both so you never have to add or subtract 360 by hand.
In polar form the magnitudes multiply and the angles add: (r1 angle t1) times (r2 angle t2) equals (r1 r2) angle (t1 + t2). In rectangular form the same operation needs four multiplications and two additions with careful sign handling. For cascaded networks, where you may be multiplying a dozen terms, polar form is dramatically less error-prone.
Undefined — a vector of zero length points nowhere. atan2(0, 0) returns 0 by convention so that code does not crash, and this calculator warns when you hit that case so the result is not mistaken for a real measurement.

Related Articles

Related Calculators