Vector Components Calculator — Find X, Y and Z Components

Convert magnitude and direction to Cartesian components, or convert x, y and z components back to magnitude and direction. Projection, rejection and unit-vector results are available when needed.

Vector inputs

Number of dimensions
Conversion
Added to dimensional results.
Length of the vector; must be zero or greater.
Counterclockwise from the positive x-axis.

Negative angles and angles beyond one turn are accepted and treated as coterminal angles. A bearing measured clockwise from +y converts to this convention with θ = 90° − bearing.

Project onto another vector

Optional: enter every component of reference vector b to find the scalar projection, vector projection and rejection of a.

Projection onto a zero vector is undefined because it has no direction and |b|² would be zero.
Enter a magnitude and direction, choose an example, or switch conversion mode to begin.

2D component diagram

No vector is plotted yet. Enter complete 2D values or choose an example.

The diagram uses a numeric scale and labels the x/y components, direction angle, projection and rejection. In 3D, use the complete non-graphical results table.

Advertisement

Vector component formulas

  • Vx = V cos θ and Vy = V sin θ
  • |V| = √(Vx² + Vy²) and θ = atan2(Vy, Vx)
  • In 3D, |V| = √(Vx² + Vy² + Vz²), φ = atan2(Vy,Vx), and θ = atan2(Vz,√(Vx²+Vy²)).

V or |V| is magnitude; Vx, Vy and Vz are Cartesian components; θ is the 2D direction or 3D elevation; and φ is 3D azimuth.

How to find x and y components

Measure the direction counterclockwise from the positive x-axis. Multiply the magnitude by cosine for the horizontal component and by sine for the vertical component. The signs follow the quadrant automatically.

Components from magnitude and direction

Basic 2D example: 10 at 30°

Vx = 10 cos 30° = 8.660 and Vy = 10 sin 30° = 5.000, so V = ⟨8.660, 5.000⟩.

Quadrant example: components −8 and 6

|V| = √((-8)² + 6²) = 10. The quadrant-aware calculation atan2(6,−8) gives 143.130°, correctly placing the vector in quadrant II.

Magnitude and direction from components

Use the Pythagorean formula for magnitude. Use atan2, not plain tan⁻¹(Vy/Vx), because atan2 retains the component signs and therefore identifies the correct quadrant. A zero vector has magnitude zero but no defined direction.

2D versus 3D components

A 2D vector needs x and y. A 3D vector adds z and uses two direction angles: azimuth in the x–y plane and elevation above that plane. From magnitude, azimuth φ and elevation θ: Vx = V cos θ cos φ, Vy = V cos θ sin φ, and Vz = V sin θ.

3D example: ⟨3, 4, 12⟩

|V| = √(3²+4²+12²) = 13, azimuth atan2(4,3) = 53.130°, and elevation atan2(12,5) = 67.380°.

Cartesian components versus projection

TermDefinitionFormulaOutput type
Cartesian componentAmount along a coordinate axisVx = V cos θNumber tied to an axis
Scalar component of a along bSigned length of a along bcompb(a) = (a·b)/|b|Scalar
Vector projection of a onto bFull vector parallel to bprojb(a) = (a·b/|b|²)bVector

Projection example: a = ⟨6, 8⟩ onto b = ⟨4, 0⟩

a·b = 24, |b|² = 16, and the factor is 24/16 = 1.5. Thus projb(a) = 1.5⟨4,0⟩ = ⟨6,0⟩, scalar projection = 6, and rejection = ⟨0,8⟩.

Methodology and accuracy

Reviewed by: Starlight Robotics Engineering Team (engineering and applied mathematics). Last reviewed: 15 July 2026.

The calculator uses the formulas displayed above and JavaScript double-precision arithmetic, then rounds only the displayed result to your selected precision. Intermediate calculations retain full precision. Zero vectors have no direction or unit vector; projection onto a zero reference vector is undefined. Calculations run locally in your browser and are not uploaded.

Accuracy note: Independently verify inputs, units and results before safety-critical engineering use.

Vector components FAQ

How do I find the x and y components of a vector?

For magnitude V and direction θ measured counterclockwise from the positive x-axis, use Vx = V cos θ and Vy = V sin θ.

Why do cosine and sine sometimes swap?

They swap when the stated angle is measured from the y-axis instead of the x-axis. Cosine gives the component adjacent to the stated angle; this calculator measures from the positive x-axis.

How do I recover a vector's direction from its components?

In 2D use θ = atan2(Vy,Vx), which uses both signs to identify the correct quadrant. In 3D use azimuth atan2(Vy,Vx) and elevation atan2(Vz,√(Vx²+Vy²)).

How do negative components affect the quadrant?

The signs locate the vector: positive-positive is quadrant I, negative-positive II, negative-negative III, and positive-negative IV.

Can vector direction angles be negative or greater than 360 degrees?

Yes. Coterminal angles describe the same direction. The calculator accepts them and reports the equivalent standard direction from 0° up to, but not including, 360°.

Should I use degrees or radians?

Use the unit in which your angle is given and select the matching control. A full turn is 360° or 2π radians.

What happens for a zero vector?

Its magnitude is zero, but its direction and unit vector are undefined because a zero-length vector does not point anywhere.

What is the difference between scalar and vector projection?

The scalar projection is a signed number giving the component of a along b. The vector projection is a vector parallel to b with that signed length and direction.

Explore more tools