Skip to content
Calc.
← All articles
linear-algebraBy Emil BjörkMarch 4, 2026

Vector Dot Product: How to Calculate It and What It Tells You

The dot product of two vectors is a single number: multiply matching components and add the products. That number measures how much the two vectors point the same way, which is why it shows up in angle calculations, orthogonality tests, projections, physics (work = force · displacement) and lighting in computer graphics. This guide shows the 3D formula, a worked example, and how to read the result.

What the Dot Product Is

The dot product (also called the scalar product or inner product) takes two vectors and returns a scalar, a plain number rather than another vector. That distinguishes it from the cross product, which returns a vector perpendicular to both inputs.

The scalar represents alignment. When two vectors point in roughly the same direction, the dot product is positive. When they point in opposite directions, it is negative. When they are exactly perpendicular, it is zero. Physics uses it to compute work (force dotted with displacement), graphics engines use it for shading (light direction dotted with the surface normal), and machine learning uses it to measure similarity between high-dimensional vectors. The formula is the same whether the vectors have three components or three thousand.

How to Calculate the Dot Product

For two 3D vectors v1 = (v1x, v1y, v1z) and v2 = (v2x, v2y, v2z):

v1 · v2 = (v1x × v2x) + (v1y × v2y) + (v1z × v2z)

Multiply the two x-components, multiply the two y-components, multiply the two z-components, then add the three products. No square roots, no division: three multiplications and two additions. For 2D vectors, set both z-components to zero.

Worked example. Let v1 = (2, 3, 4) and v2 = (5, −1, 2):

1. x-components: 2 × 5 = 10

2. y-components: 3 × (−1) = −3

3. z-components: 4 × 2 = 8

4. Add the products: 10 + (−3) + 8 = 15

The dot product is 15. Because the result is positive, the angle between the two vectors is less than 90°. The Vector Dot Product Calculator takes the six components and returns this scalar.

Angles, Orthogonality and Projection

The number becomes more useful once you connect it to geometry. The dot product also equals the product of the two vectors' lengths times the cosine of the angle θ between them:

v1 · v2 = |v1| × |v2| × cos(θ)

Rearranging gives the angle: cos(θ) = (v1 · v2) ÷ (|v1| × |v2|). Continuing the example, the magnitudes are |v1| = √(4 + 9 + 16) = √29 and |v2| = √(25 + 1 + 4) = √30, so |v1| × |v2| = √870 ≈ 29.496. Then cos(θ) = 15 ÷ 29.496 ≈ 0.5085 and θ ≈ 59.4° (rounded to one decimal; rounding the magnitudes to two decimals first gives 59.5°, which is why hand calculations often differ slightly). The Angle Between Vectors Calculator returns the angle directly for 2D vectors (x and y components only).

Orthogonality. If two non-zero vectors are perpendicular, θ = 90°, cos(90°) = 0, and the dot product is zero. Checking whether the dot product equals zero is therefore the fastest right-angle test, with no trigonometry needed.

Projection. The length of one vector's shadow along the direction of another, the scalar projection, is the dot product divided by the second vector's length: (v1 · v2) ÷ |v2|. Multiplying that by the unit vector of v2 gives the vector projection. This is how you split a force into "along the ramp" and "into the ramp" parts. The Vector Projection Calculator returns the projected vector, the scalar projection or a single component, for 2D or 3D vectors.

Common Mistakes

Confusing it with the cross product. The dot product returns a scalar; the cross product returns a vector perpendicular to both inputs. If your answer is a single number, you computed a dot product; if it is a vector, you did not. For vectors in a plane, the 2D Vector Cross Product calculator handles the other operation, returning the signed z-component.

Mismatching components. Always pair x with x, y with y, and z with z. Pairing v1x with v2y is the most common slip and silently produces a wrong answer.

Dropping a sign. A negative dot product is meaningful: the vectors are more than 90° apart. Losing a minus sign on one component flips the geometric interpretation.

Misreading zero. A zero dot product between non-zero vectors means perpendicular. If one vector is the zero vector, the dot product is zero regardless of the other, and the angle is undefined because the zero vector has no direction.

Comparing raw dot products across different lengths. A large dot product can come from long vectors rather than good alignment. Divide by both magnitudes (or normalize the vectors first) before using it as a measure of similarity.

Sources

Related articles

Looking for a calculator?

Calculator Collection has 1,400+ free calculators. Browse all calculators →