Vector Angle Calculator

The angle between two vectors comes from the dot product: cos θ = (A·B) ÷ (|A| |B|). Enter the components separated by commas, in any number of dimensions.

Also called: Angle between vectors calculator

  • Last updated
  • Formula tested against reference values

Your numbers

Components separated by commas, e.g. 3, 4 or 1, -2, 2. Any number of dimensions from 2 to 50.

Same number of components as vector A.

Result

Angle between the vectors
—°

Calculating…

Angle in radians
—
cos θ
—
Dot product A·B
—
|A|
—
|B|
—
Relationship
—

How to use this calculator

  1. Enter or choose vector A.
  2. Enter or choose vector B.
  3. The angle between the vectors updates as you type. Use Copy result or Share to keep it.

Method

cos θ = (A·B) ÷ (|A| × |B|); A·B = Σ aᵢbᵢ; |A| = √(Σ aᵢ²); θ = arccos(cos θ)

A, B
the two vectors
aᵢ, bᵢ
their components
θ
the angle between them, from 0° to 180°

Worked example

  1. A·B = 3×4 + 4×3 = 24.
  2. |A| = √(9+16) = 5 and |B| = 5.
  3. cos θ = 24 ÷ 25 = 0.96, so θ = arccos 0.96 ≈ 16.2602°.

The vectors (3, 4) and (4, 3) are about 16.26° apart.

What the result means

A dot product of zero means a right angle; a positive one means less than 90° and a negative one more than 90°. The angle never exceeds 180° because it is measured the short way round.

Assumptions and limits

  • Both vectors are in the same space and use the same orthonormal (ordinary Cartesian) basis.
  • The angle is undefined if either vector is zero.
  • This is the unsigned angle; a signed (clockwise or anticlockwise) angle needs a 2D orientation convention.

Questions

Does the order of the vectors matter?

No. The dot product is symmetric, so the angle from A to B equals the angle from B to A.

Why is cos θ clamped?

Rounding can push the ratio a hair above 1 for parallel vectors; it is limited to the range −1 to 1 so arccos stays defined.