Vector Magnitude Calculator

Enter a vector's x, y, and optional z components to get its magnitude (|v| = √(x² + y² + z²)), unit vector, and direction angles.

Quick Facts

Magnitude formula
|v| = √(x² + y² + z²)
A direct application of the Pythagorean theorem across each axis; set z = 0 for a 2D vector.
Unit vector
v̂ = v / |v|
Divide each component by the magnitude to get a vector of length 1 pointing the same direction.
Direction cosines
cos α = x/|v|, cos β = y/|v|, cos γ = z/|v|
The cosines of the angles the vector makes with the x, y, and z axes.

Your Results

Calculated
Magnitude |v|
-
√(x² + y² + z²)
Squared Magnitude |v|²
-
x² + y² + z² (sum before the root)
Unit Vector
-
v / |v|, a vector of length 1
Direction Angles (α, β, γ)
-
Angles from the x, y, z axes

Ready

Enter the vector's components, then press Calculate.

Formula and Method for Vector Magnitude

The magnitude of a vector — also called its length or norm — measures how far its tip is from its tail, regardless of direction. For a vector v = (x, y, z) in three-dimensional space, the magnitude is |v| = √(x² + y² + z²). This is simply the Pythagorean theorem extended to three axes: each component is squared, the squares are summed, and the square root of that sum gives the straight-line length. For a 2D vector, drop the z term — |v| = √(x² + y²) — which is exactly what the 3D formula reduces to when z = 0, so this calculator can handle either case with the same fields.

How the calculation works

Enter the vector's x and y components, and its z component if the vector is three-dimensional (leave z at 0 for a flat, 2D vector). The calculator squares each component, adds the squares together, and takes the square root to get the magnitude |v|. It also reports the squared magnitude |v|² (useful when comparing lengths without the cost of a square root), the unit vector v̂ = (x/|v|, y/|v|, z/|v|) — a vector of length 1 pointing the same way as the original — and the direction angles (α, β, γ) that the vector makes with the positive x, y, and z axes, found by taking the arccosine of each unit-vector component (cos α = x/|v|, and so on).

Common mistakes

  • Confusing magnitude with a component: the vector (3, 4) has x = 3 and y = 4, but its magnitude is 5, not 3 or 4 or 7.
  • Forgetting to square before summing: magnitude is √(x² + y²), not (x + y) — negative components must be squared away before adding.
  • Dividing by zero magnitude: the zero vector (0, 0, 0) has no defined direction, so its unit vector and direction angles do not exist.
  • Mixing 2D and 3D by accident: leaving a nonzero value in the z field when you meant a 2D vector will change the magnitude — set z to 0 explicitly for 2D problems.

Real-world applications

  • Physics uses vector magnitude to find the speed from a velocity vector, the strength of a force, or the size of an electric or magnetic field.
  • Computer graphics and game engines normalize direction vectors (divide by magnitude) constantly for lighting, movement, and collision calculations.
  • Navigation and robotics use magnitude to compute displacement or distance traveled from a position vector's components.
  • Engineering statics uses magnitude and direction angles to resolve forces into components and check equilibrium.

Frequently Asked Questions

What is the formula for vector magnitude?
The magnitude (length) of a vector is the square root of the sum of the squares of its components: |v| = √(x² + y² + z²) for a 3D vector, or |v| = √(x² + y²) for a 2D vector (leave z at 0). This comes directly from the Pythagorean theorem applied across each axis.
How do I find the magnitude of a 2D vector versus a 3D vector?
A 2D vector only has x and y components, so its magnitude is √(x² + y²). A 3D vector adds a z component, so its magnitude is √(x² + y² + z²). Setting z = 0 in the 3D formula reduces it exactly to the 2D case, which is why this calculator can handle both.
What is a unit vector and how is it related to magnitude?
A unit vector has a magnitude of exactly 1 and points in the same direction as the original vector. You find it by dividing each component of the vector by its magnitude: v̂ = (x/|v|, y/|v|, z/|v|). Unit vectors are undefined for the zero vector, since dividing by a magnitude of 0 is impossible.
What are direction angles and direction cosines?
Direction angles (α, β, γ) are the angles a vector makes with the positive x, y, and z axes. Their cosines, called direction cosines, equal the unit vector's components: cos α = x/|v|, cos β = y/|v|, cos γ = z/|v|. For a 2D vector (z = 0), γ is 90° and α is the familiar angle measured from the x-axis.