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.
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:
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.
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:
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.
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.
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.
Suppose you want to find the dot product and angle between A = (2, −1, 3) and B = (4, 0, −2).
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.
|A| = √(22 + (−1)2 + 32) = √(4 + 1 + 9) = √14.
|B| = √(42 + 02 + (−2)2) = √(16 + 0 + 4) = √20.
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).
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).
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. |
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.
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.
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.
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.
Tap or drag to rotate Vector B. Keyboard: ← → to rotate, space to steady the drift. Hold alignment to multiply your score.