Skip to content
math

Dot Product Calculator

Compute the dot product a · b and the angle between two 2D or 3D vectors instantly.

a · b
32
Angle between
12.9332°

How it works

  1. 1Enter the x and y (and optionally z) components for vectors a and b — switch between 2D and 3D with the tabs at the top.
  2. 2The dot product a · b is computed as Σ aᵢ · bᵢ, summing each pair of matching components.
  3. 3The angle θ between the vectors is found from cos θ = (a · b) / (|a| |b|), then converted to degrees; the result is — when either vector is the zero vector.

Use cases

  • Physics and engineering: determine whether two force or velocity vectors are perpendicular (a · b = 0) or parallel (θ = 0° or 180°).
  • Computer graphics: use the dot product to calculate lighting intensity — the cosine of the angle between a surface normal and a light direction.
  • Machine learning: measure cosine similarity between feature vectors or word embeddings by normalising the dot product by the magnitudes.

Frequently asked questions

What does the dot product tell you?

The dot product a · b = |a| |b| cos θ encodes both the relative orientation and the magnitudes of the two vectors. A positive value means the angle between them is acute, zero means they’re perpendicular, and a negative value means the angle is obtuse.

Why is the angle shown as — for the zero vector?

The angle formula requires dividing by each vector’s magnitude. When either magnitude is zero the division is undefined, so no meaningful angle exists and the calculator displays — rather than a misleading number.

Does the dot product work the same way in 2D and 3D?

Yes — it’s always the sum of the products of matching components: a · b = ax·bx + ay·by in 2D, and ax·bx + ay·by + az·bz in 3D. Switching between 2D and 3D simply adds or removes the z term.

See all →