🧮
🧮 Math & statistics

Vector Calculator (dot, cross, angle, magnitude)

Results update as you type.

Your numbers

Understanding the vector calculator — concept and principle

This calculator works with two 3D vectors a and b. It returns the dot product, the cross product, both magnitudes, the angle between the vectors, and the vector projection of a onto b. These operations are the core of vector algebra and appear in physics (work, torque, magnetic force), computer graphics (lighting, surface normals), machine learning (cosine similarity) and engineering statics. For 2D vectors, enter 0 or leave out the z component.

Dot product of (1, 2, 3) and (4, 5, 6)Matching components multiply to 4, 10 and 18, which add to 32. Dividing by the lengths 3.742 and 8.775 gives cos = 0.975, an angle of 12.93°.Dot product: pair up, multiply, addab1×4=42×5=103×6=184 + 10 + 18= 32a: 3.74b: 8.77angle between12.93°(pink wedge)cos = 32 ÷ (3.742 × 8.775) = 0.975cross a × b = (−3, 6, −3), ⟂ to both
A dot product of 32, close to the 32.83 maximum, means the arrows point almost the same way.

How it is calculated

The principle

Geometrically, a·b = |a||b| cos θ: it measures how much the two vectors point the same way. Combining this with the component formula gives the angle. The projection scales b by a·b ÷ |b|², the length of a's shadow on b divided by |b|. The cross product is a vector perpendicular to both a and b, with length |a||b| sin θ (the area of the parallelogram they span) and direction given by the right-hand rule.

Worked example

  1. Defaults: a = (1, 2, 3), b = (4, 5, 6).
  2. a·b = 1·4 + 2·5 + 3·6 = 4 + 10 + 18 = 32.
  3. a×b = (2·6 − 3·5, 3·4 − 1·6, 1·5 − 2·4) = (−3, 6, −3).
  4. |a| = √14 = 3.741657387; |b| = √77 = 8.774964387.
  5. cos θ = 32 ÷ (3.741657 × 8.774964) = 0.974632, so θ = 12.93315449°.
  6. Projection: 32 ÷ 77 = 0.415584 times (4, 5, 6) = (1.662337662, 2.077922078, 2.493506494).

How to read the result

A positive dot product means the angle is acute, zero means the vectors are perpendicular, and negative means obtuse. The cross product is (0, 0, 0) when the vectors are parallel. Here θ ≈ 12.9° shows that a and b point in nearly the same direction, and |a×b| = √54 ≈ 7.35 is the area of their parallelogram. You can check the cross product: (−3, 6, −3)·a = −3 + 12 − 9 = 0.

Common mistakes

Keep in mind: The angle is undefined if either vector is zero. Rounding can make an exact 0° or 180° appear as a small non-zero angle.

Frequently asked questions

How do I check whether two vectors are perpendicular?

Their dot product is 0. For example (1, 0, 0)·(0, 3, 0) = 0.

What is cosine similarity?

It is a·b ÷ (|a||b|), the cosine of the angle between vectors, often used to compare data vectors. For the defaults it is 0.9746.

How do I get a vector perpendicular to a plane containing a and b?

Use a×b; it is normal to the plane spanned by a and b.

Sources: Gilbert Strang, Introduction to Linear Algebra, Chapter 1 (vectors, lengths and dot products) · James Stewart, Calculus: Early Transcendentals, sections on the dot product and the cross product

Checked 8 Nov 2026. Standard formulas, computed in your browser with double-precision numbers.

🧮 All math & statistics tools →🌍 Calculators by country →