Vector Dot Product Calculator

JJ Ben-Joseph headshot JJ Ben-Joseph

Use this vector dot product calculator to compare two 3D vectors from their components Ax, Ay, Az and Bx, By, Bz. The tool computes the dot product, each vector’s magnitude (length), the angle between them, and the scalar component of one vector along the other. This guide explains the formulas, how to interpret the results, and where these calculations are used in practice.

1. What is the dot product?

A vector represents a quantity with both magnitude and direction, such as force, velocity, or displacement. The dot product (also called the scalar product) is a way to multiply two vectors and obtain a single number that measures how aligned they are.

For two 3D vectors A = (Ax, Ay, Az) and B = (Bx, By, Bz), the dot product is defined component-wise as

Dot product formula (components):

A · B = AxBx + AyBy + AzBz

Geometrically, the dot product can also be written in terms of lengths and the angle θ between the vectors:

A B = |A| |B| cos θ

Here |A| and |B| are the magnitudes (lengths) of the vectors. This relationship is the key to finding the angle between two vectors from their components.

2. Vector magnitudes and the angle between two vectors

The magnitude (length) of a 3D vector is found using the 3D version of the Pythagorean theorem:

Magnitude of A: |A| = √(Ax2 + Ay2 + Az2)

Magnitude of B: |B| = √(Bx2 + By2 + Bz2)

Once you know A · B, |A|, and |B|, you can solve for the angle θ between the vectors using the geometric dot product formula rearranged as:

Angle formula:

θ = cos -1 ( AB |A| |B| )

The calculator computes θ in degrees. If either vector has zero magnitude, the angle between them is undefined because you cannot determine a direction for a zero vector.

3. Interpreting the dot product result

The sign and size of the dot product give quick geometric information:

The dot product also captures how large the component of one vector is along the direction of the other. If you normalize one vector (make its length 1), the dot product with the other vector directly gives this signed component.

4. Projections: how much of one vector lies along another?

A common use of the dot product is to project one vector onto another, for example to find how much of a force acts along a specific axis or surface.

The scalar projection of A onto B (also called the component of A along B) is

compB(A) = (A · B) / |B|

The vector projection of A onto B is the vector that lies in the direction of B with this length:

projB(A) = (A · B / |B|2) B

This calculator focuses on the dot product, magnitudes, and angle, but the same intermediate values can be used to compute projections if needed.

5. Worked example

Suppose you want to find the dot product and angle between A = (2, −1, 3) and B = (4, 0, −2).

5.1 Entering the vectors

5.2 Dot product

A · B = (2)(4) + (−1)(0) + (3)(−2)

= 8 + 0 − 6 = 2.

The dot product is positive but relatively small, so the vectors are slightly more aligned than perpendicular.

5.3 Magnitudes

|A| = √(22 + (−1)2 + 32) = √(4 + 1 + 9) = √14.

|B| = √(42 + 02 + (−2)2) = √(16 + 0 + 4) = √20.

5.4 Angle between A and B

Use the angle formula:

cos θ = (A · B) / (|A||B|) = 2 / (√14 ⋅ √20).

First compute the denominator: √14 ⋅ √20 = √(14 ⋅ 20) = √280.

So cos θ = 2 / √280 ≈ 2 / 16.733 ≈ 0.1195.

Then θ = arccos(0.1195) ≈ 83.1°.

When you enter these values into the calculator, it should return a dot product of 2 and an angle close to 83°, matching the hand calculation (small differences may arise from rounding).

5.5 Optional: projection

If you also want the projection of A onto B, use

projB(A) = (A · B / |B|2) B = (2 / 20) B = 0.1 B.

So projB(A) = 0.1 (4, 0, −2) = (0.4, 0, −0.2).

6. Comparison: dot product vs related vector operations

The dot product is one of several basic operations on vectors. The table below compares it with a few closely related concepts.

Operation Input Output Main use
Dot product (this calculator) Two vectors A, B Scalar A · B Measures alignment; used to find angles, work, and projections.
Magnitude (length) One vector A Scalar |A| Size of a vector; distance from origin; needed for angles and normalization.
Normalization One nonzero vector A Unit vector A / |A| Keeps direction, sets length to 1; simplifies direction-only calculations.
Vector projection Two vectors A, B Vector projB(A) Component of A along B; resolving vectors along chosen directions.
Cross product (3D only) Two vectors A, B Vector A × B Produces a vector perpendicular to both; used for torque, area, and normals.

7. Applications of the dot product

7.1 In physics: work and forces

In mechanics, the work done by a constant force F acting over a displacement s is defined as W = F · s. Only the component of the force in the direction of motion contributes to work. If the force is perpendicular to the motion, the dot product is zero and no work is done.

7.2 In computer graphics: lighting and shading

In 3D rendering, the brightness of a surface under directional light often depends on the dot product between a unit surface normal vector and a unit light direction vector. A larger dot product means the surface faces the light more directly and appears brighter, while a negative dot product means the surface faces away from the light.

7.3 In data science: cosine similarity

High-dimensional feature vectors (for example, document embeddings) are often compared using cosine similarity, defined as (A · B) / (|A||B|). This is exactly the same expression used to compute cos θ for the angle between vectors, so cosine similarity is the cosine of the angle between two data vectors.

8. How to use this calculator step by step

  1. Identify the components of your two 3D vectors: A = (Ax, Ay, Az) and B = (Bx, By, Bz).
  2. Enter Ax, Ay, and Az into the Vector A input fields.
  3. Enter Bx, By, and Bz into the Vector B input fields.
  4. Click the button to compute the dot product.
  5. Read off the dot product, magnitudes, and angle in degrees from the results panel as provided by the page.

9. Limitations and assumptions

Vector A Components
Vector B Components
Enter vectors.

Projection Pulse

Align Vector B with the golden lane to maximize the dot product. Chase the cosine sweet spot as gusts twist your aim and the target alignment shifts.

Target Angle --
Alignment --
Streak 0.0s
Score 0
Time Left 90s

Tap or drag to rotate Vector B. Keyboard: ← → to rotate, space to steady the drift. Hold alignment to multiply your score.

Embed this calculator

Copy and paste the HTML below to add the Dot Product Calculator – 3D Vector Angle, Magnitude & Projection to your website.