Find the magnitude (length) of a 2D or 3D vector from its x, y, and optional z components.
How it works
The magnitude is the square root of the sum of the squared components: |v| = √(x² + y² + z²). A vector (3, 4) has magnitude 5 — the same 3-4-5 relationship as a right triangle, because the formula is really just the Pythagorean theorem generalized.
What this does not include
This handles 2D and 3D vectors (leave z blank for 2D). It doesn’t extend to higher-dimensional vectors, which would need additional component fields not offered here.
How to use this calculator
- Enter the x and y components.
- Enter z as well for a 3D vector, or leave it blank for 2D.
A worked example
A 2D vector (3, 4): magnitude = √(3²+4²) = 5 — the classic 3-4-5 right triangle.
A 3D vector (2, 3, 6): magnitude = √(2²+3²+6²) = 7.
What the variables mean
| Variable | Meaning |
|---|---|
| x, y | The vector’s 2D components (always required) |
| z | Optional third component, for 3D vectors |
Edge cases worth knowing
Leaving z blank calculates a 2D magnitude, not an error. The formula naturally extends the Pythagorean theorem to as many dimensions as have values entered.
Magnitude is always non-negative, regardless of whether the individual components are positive or negative — it’s a square root of a sum of squares, and squares eliminate any negative sign before the square root ever sees them.
Why is this the same formula as the Pythagorean theorem?
A 2D vector’s components are literally the legs of a right triangle, with the vector itself as the hypotenuse — the distance formula and the Pythagorean theorem are the same relationship viewed two ways.
Can vector magnitude be negative?
No — magnitude is a length, and lengths are never negative regardless of whether the individual components are positive or negative, since each is squared before being summed.
What is vector magnitude used for?
Physics uses it to find a force or velocity’s overall strength regardless of direction; it’s also the basis for normalizing a vector to a fixed length of 1.