Dot Product Calculator

Find the dot product of two vectors of any dimension, plus their lengths, the angle between them and the projection of one onto the other.

Components separated by commas or spaces — any dimension (2D, 3D, …).
|a| (length of a)
√38≈ 6.164414003
|b| (length of b)
√21≈ 4.582575695
Angle θ (degrees)
79.805045°
Angle θ (radians)
1.3928607929
cos θ
0.1769980814
Relationship
acute angle (less than 90°)
Scalar projection of a on b
1.0910894512a·b ÷ |b|
Vector projection of a on b
⟨5/21, 20/21, 10/21⟩(a·b ÷ |b|²) b
a · b (3D)5

Show the work

  1. Multiply matching components: 3 × 1 + (−2) × 4 + 5 × 2
  2. = 3 − 8 + 10 = 5
  3. Magnitudes: |a| = √(32 + (−2)2 + 52) = √38 ≈ 6.164414003, and |b| = √21 ≈ 4.582575695.
  4. Angle: cos θ = a·b ÷ (|a||b|) = 5 ÷ (6.164414 × 4.582576) = 0.1769980814, so θ = arccos(0.17699808) = 79.805045°.
  5. The dot product is positive, so the angle is acute.

The dot product combines two vectors into a single number that measures how much they point in the same direction. It is positive when the angle between them is acute, zero when they are perpendicular, and negative when the angle is obtuse. This calculator computes it for vectors of any dimension and also reports each vector’s length, the angle between them and the projection of one vector onto the other.

How to use the dot product calculator

  1. Type the components of vector a, separated by commas or spaces, for example 3, -2, 5. Brackets are optional, and fractions such as 1/3 are allowed.
  2. Type vector b with the same number of components.
  3. The tape shows a·b, the magnitudes, the angle in degrees and radians, the relationship (acute, obtuse, perpendicular or parallel) and the projections. For 2D vectors a diagram draws both arrows and the angle between them.

Dot product formulas

a · b = a₁b₁ + a₂b₂ + … + anbn = |a| |b| cos θ
|a| = √(a · a)  ·  θ = arccos( a·b ÷ (|a| |b|) )  ·  projba = (a·b ÷ |b|²) b

The two forms of the dot product, the component sum and the |a||b| cos θ version, are equal by the law of cosines. That equality is what lets you get an angle from pure arithmetic.

Worked example

Let a = ⟨3, −2, 5⟩ and b = ⟨1, 4, 2⟩.

Dot product: 3(1) + (−2)(4) + 5(2) = 3 − 8 + 10 = 5.

Magnitudes: |a| = √(9 + 4 + 25) = √38 ≈ 6.164414; |b| = √(1 + 16 + 4) = √21 ≈ 4.582576.

Angle: cos θ = 5 ÷ (6.164414 × 4.582576) ≈ 0.176998, so θ ≈ 79.81°. The dot product is positive but small, so the vectors are nearly perpendicular.

Projection: (5 ÷ 21) b = ⟨5/21, 20/21, 10/21⟩, the "shadow" of a on the line of b.

Interpreting the sign

a · b Angle θ Meaning
positive 0° ≤ θ < 90° vectors point broadly the same way
zero 90° perpendicular (orthogonal)
negative 90° < θ ≤ 180° vectors point broadly opposite ways
equal to ±|a||b| 0° or 180° parallel

The calculator checks the parallel case exactly: when (a·b)² equals |a|²|b|², the vectors are scalar multiples of each other.

Applications

  • Work in physics. The work done by a constant force F moving an object through displacement d is W = F · d. Pushing a 50-newton force at 30° to a 10-meter path does 50 × 10 × cos 30° ≈ 433 joules of work.
  • Shading in graphics. Brightness of a surface is proportional to the dot product of the unit surface normal and the unit direction to the light; a negative value means the surface faces away.
  • Similarity of data. Cosine similarity, the cosine of the angle between two data vectors, is the dot product of the vectors divided by their lengths. It is used to compare documents, ratings and embeddings.
  • Testing perpendicularity. Two lines or planes are perpendicular when their direction or normal vectors have a zero dot product.

Dot product vs. cross product

The dot product returns a number and works in any dimension. The cross product returns a vector perpendicular to both inputs and is defined for 3D vectors. Together they give |a·b| = |a||b| |cos θ| and |a × b| = |a||b| sin θ. For the vector version, use the cross product calculator; to turn a cosine into an angle by hand, the inverse trig functions calculator evaluates arccos.

Frequently asked questions

How do you calculate a dot product?

Multiply the matching components and add the results. For a = ⟨3, −2, 5⟩ and b = ⟨1, 4, 2⟩, a·b = 3×1 + (−2)×4 + 5×2 = 3 − 8 + 10 = 5. The answer is a single number (a scalar), not a vector.

How do I find the angle between two vectors?

Use cos θ = (a·b) ÷ (|a| |b|) and take the inverse cosine. For the vectors above, cos θ = 5 ÷ (√38 × √21) ≈ 0.177, so θ ≈ 79.81°.

What does a dot product of zero mean?

If neither vector is the zero vector, a dot product of 0 means the vectors are perpendicular (orthogonal): the angle between them is exactly 90°.

Does the dot product work in more than three dimensions?

Yes. The definition, multiply matching components and add, works for any number of components, and so does the angle formula. This calculator accepts up to 100 components, which is useful for data vectors in statistics and machine learning.

Last reviewed October 2026 by the CalcFluent editorial team. How we check our calculators.