Skip to content
TheCalcUniverse

Dot Product Calculator — Vector Dot Product & Angle

Calculate the dot product of two vectors, the angle between them, and determine if they are orthogonal. Supports 2D and 3D vectors.

✓ Tested formula & cited sources Formula verified 2026-01-15 Runs in your browser — inputs never sent anywhere

See it worked out

Example — a₁ (v₁x) 2, a₂ (v₁y) 3, a₃ (v₁z) 0, b₁ (v₂x) 5:

a · b

28

|a|

3.605551

|b|

7.81025

Angle Between

6.115504°

cos θ

0.994309

Orthogonal?

No

Scalar Projection of a onto b

3.585033

The formula

a · b = a₁b₁ + a₂b₂ + a₃b₃ = |a||b|cos θ

a = (a₁, a₂, a₃)
First Vector
b = (b₁, b₂, b₃)
Second Vector
a · b
Dot Product
|a|, |b|
Magnitudes
θ
Angle

Worked example — a₁ (v₁x) 2, a₂ (v₁y) 3, a₃ (v₁z) 0, b₁ (v₂x) 5

a · b = 28

Full explanation ↓

How Dot Product Works

a · b = a₁b₁ + a₂b₂ + a₃b₃ = |a||b|cos θ

The dot product (also called the scalar product or inner product) is an algebraic operation that takes two equal-length sequences of numbers and returns a single number. Geometrically, it is the product of the Euclidean magnitudes of the two vectors and the cosine of the angle between them. The dot product is zero when the vectors are orthogonal (perpendicular), positive when they point in similar directions (angle < 90°), and negative when they point in opposite directions (angle > 90°).

a = (a₁, a₂, a₃)
First VectorThe first input vector defined by its components.
b = (b₁, b₂, b₃)
Second VectorThe second input vector defined by its components.
a · b
Dot ProductThe scalar result of the dot product: a₁b₁ + a₂b₂ + a₃b₃.
|a|, |b|
MagnitudesThe lengths of vectors a and b, calculated as √(x² + y² + z²).
θ
AngleThe angle between the two vectors, derived from cos θ = (a·b)/(|a||b|).
The dot product measures how much two vectors align with each other, reaching maximum when parallel and zero when perpendicular

How to Use

  1. Enter the components of the first vector (a) and second vector (b). The z-components are optional (default 0).
  2. The calculator computes the dot product, magnitudes, and the angle between the vectors.
  3. Check the "Orthogonal?" result — if "Yes", the dot product is zero and the vectors are perpendicular.
  4. Review the scalar projection, which gives the length of the shadow of vector a cast onto vector b.

Quick Reference

Zero dot productVectors are perpendicular (θ = 90°)
Positive dot productVectors point in similar direction (θ < 90°)
Negative dot productVectors point in opposite directions (θ > 90°)
ProjectionScalar proj of a onto b = a·b / |b|

Common Uses

  • Physics: computing work done by a force (W = F · d), where only the force component in the direction of motion contributes.
  • Computer graphics: implementing the Phong lighting model where the dot product of the surface normal and light direction determines brightness.
  • Machine learning: calculating cosine similarity between document vectors for information retrieval and recommendation systems.
  • Game development: detecting whether a character is facing toward or away from an object using the dot product of direction vectors.
  • Linear algebra: testing orthogonality, computing projections, and implementing the Gram-Schmidt process for creating orthonormal bases.

Understanding the Result

The dot product is the simplest and most fundamental vector multiplication operation. Unlike scalar multiplication which scales a vector, the dot product combines two vectors to produce a scalar. The algebraic definition (sum of component-wise products) is easy to compute, while the geometric interpretation (|a||b|cos θ) reveals its true meaning: it measures how much one vector extends in the direction of another. When the dot product is zero, the vectors are orthogonal — a property used constantly in graphics, physics, and linear algebra. A positive dot product means the vectors are generally pointing in the same direction; a negative one means they point oppositely. The scalar projection (a · b / |b|) gives the signed length of the orthogonal projection of a onto the line through b. This is used extensively in computing components of forces, decomposing vectors into basis directions, and in the Gram-Schmidt orthogonalization process.

Frequently Asked Questions

What is the difference between dot product and cross product?
The dot product produces a scalar (a single number) and measures how aligned two vectors are. The cross product produces a vector that is perpendicular to both inputs and measures how different their directions are. The dot product works in any dimension and is commutative (a·b = b·a), while the cross product is unique to 3D and is anti-commutative (a×b = −b×a).
What does it mean if cos θ = 1 or cos θ = −1?
If cos θ = 1, the angle is 0° and the vectors are parallel and pointing in exactly the same direction. If cos θ = −1, the angle is 180° and the vectors are antiparallel (same line, opposite directions). In both cases, one vector is a scalar multiple of the other. When cos θ = 0, θ = 90° and the vectors are perpendicular (orthogonal).
How is the dot product used in machine learning?
In machine learning, the dot product is used for cosine similarity: cos θ = (a·b)/(|a||b|), which measures the similarity between two vectors regardless of their magnitude. This is commonly used in natural language processing to compare document vectors (TF-IDF or word embedding vectors), in recommendation systems to find similar items or users, and in neural networks where weighted sums are computed as dot products.
What is the scalar projection and how is it different from the vector projection?
The scalar projection (also called the scalar component) of a onto b is the signed length of the orthogonal projection of a onto the line of b. It is computed as a·b/|b|. The vector projection is the scalar projection multiplied by the unit vector in the direction of b: (a·b/|b|²)·b. The scalar projection tells you "how much of a points in b's direction," while the vector projection gives you the actual projection vector.
Was this calculator helpful?
Cite this calculator

TheCalcUniverse. "Dot Product Calculator — Vector Dot Product & Angle." TheCalcUniverse, 2026, https://thecalcuniverse.com/math/dot-product/. Accessed July 24, 2026.

Embed this calculator on your site

Free to embed. Paste this into any HTML page — it stays up to date automatically.

Open embed ↗

You may also like