
Dot Product Calculator
Use this dot product calculator and vector dot product calculator to compute the scalar product of two 3D or 2D vectors (x·u + y·v + z·w) in your browser.
Open toolEnter First vector (x, y, z) as your source vector a and Second vector (x, y, z) as your non-zero target vector b in this vector projection calculator to compute the orthogonal projection proj_b(a) = ((a . b) / (b . b)) * b in your browser. Leave both z-coordinates at 0 for 2D vectors, inspect the preloaded orthogonal baseline (0, 0, 0), or project 3D coordinates up to +-1,000,000,000.
Enter the inputs, then select Calculate.
Result will appear here
Understanding how to calculate vector projection starts with splitting a vector a = (x, y, z) into two perpendicular parts relative to a target direction b = (u, v, w): a parallel shadow a_parallel = proj_b(a) that lies directly along the line of b, and an orthogonal rejection a_perp = a - a_parallel that meets b at a 90-degree angle. Because the unit direction vector along b is b_hat = b / ||b|| and the signed scalar shadow length is comp_b(a) = (a . b) / ||b||, multiplying the scalar shadow by b_hat combines the two ||b|| denominators into ||b||^2 = b . b.
proj_b(a) = ((a . b) / (b . b)) * b = ((x*u + y*v + z*w) / (u^2 + v^2 + w^2)) * (u, v, w)
Notice that the vector projection formula never requires taking a square root. In client-side JavaScript (batch11-tools.js), the calculator evaluates both the numerator a . b and denominator b . b using Kahan compensated summation (kahan), divides them to obtain the exact scalar factor scale, and multiplies each coordinate of b by scale with 12-significant-digit formatting.
Use this benchmark table to compare source vectors a, target direction vectors b, scalar multipliers k = (a . b) / (b . b), and orthogonal rejections a_perp = a - proj_b(a) before running your own inputs in the projection of a vector calculator.
| Scenario / Application | Source Vector a = (x, y, z) | Target Vector b = (u, v, w) | Scale Factor k = (a . b) / (b . b) | Vector Projection proj_b(a) | Orthogonal Rejection a - proj_b(a) |
|---|---|---|---|---|---|
| Orthogonal Axes (Preloaded) | (1, 0, 0) | (0, 1, 0) | 0 / 1 = 0 | (0, 0, 0) | (1, 0, 0) |
| 2D Horizontal Axis Projection | (3, 4, 0) | (1, 0, 0) | 3 / 1 = 3 | (3, 0, 0) | (0, 4, 0) |
| 2D 45-Degree Diagonal Projection | (4, 2, 0) | (1, 1, 0) | 6 / 2 = 3 | (3, 3, 0) | (1, -1, 0) |
| 2D Ramp Parallel Force | (6, 8, 0) | (3, 4, 0) | 50 / 25 = 2 | (6, 8, 0) | (0, 0, 0) |
| 2D Obtuse Opposite Projection | (-2, -1, 0) | (3, 1, 0) | -7 / 10 = -0.7 | (-2.1, -0.7, 0) | (0.1, -0.3, 0) |
| 3D Integer Quadruple Line | (2, 2, 6) | (1, 2, 2) | 18 / 9 = 2 | (2, 4, 4) | (0, -2, 2) |
| 3D Obtuse Quadruple Line | (-2, -2, -6) | (1, 2, 2) | -18 / 9 = -2 | (-2, -4, -4) | (0, 2, -2) |
| 3D Gram-Schmidt Step | (3, 3, 6) | (1, 2, 2) | 21 / 9 = 7/3 | (2.33333333333, 4.66666666667, 4.66666666667) | (0.66666666667, -1.66666666667, 1.33333333333) |
| 3D Space Diagonal Projection | (3, 0, 0) | (1, 1, 1) | 3 / 3 = 1 | (1, 1, 1) | (2, -1, -1) |
| Zero Source Vector onto Line | (0, 0, 0) | (2, -3, 6) | 0 / 49 = 0 | (0, 0, 0) | (0, 0, 0) |
Follow these three steps to enter the projected vector a, set the target direction b, and export your 3D coordinate tuple.
Type the coordinates of the source vector a into First vector x (#x, default 1), First vector y (#y, default 0), and First vector z (#z, default 0).
Fill in Second vector x (#u), Second vector y (#v, preloaded with 1), and Second vector z (#w) for the line vector b onto which a is projected. Keep both z inputs at 0 for 2D vectors.
Click Calculate result to generate the projected vector tuple (x, y, z). Use Copy or Download to transfer the result into your Gram-Schmidt worksheet or physics model.
These three worked examples show how a projection calculator vector workflow resolves orthogonal axes, 2D planar shadows, and 3D force components.
With the preloaded vectors a = (1, 0, 0) and b = (0, 1, 0), the dot product is 1(0) + 0(1) + 0(0) = 0 while b . b = 0^2 + 1^2 + 0^2 = 1. Scaling b by 0 / 1 = 0 returns (0, 0, 0) because a horizontal vector casts zero shadow onto a vertical axis.

To project the 2D planar vector a = (4, 2, 0) onto the 45-degree line b = (1, 1, 0), compute a . b = 4(1) + 2(1) + 0(0) = 6 and b . b = 1^2 + 1^2 + 0^2 = 2. Multiplying b by k = 6 / 2 = 3 produces the projected vector (3, 3, 0).

A winch pulls with force a = (2, 2, 6) kN on a carriage constrained to a 3D rail aligned with b = (1, 2, 2). Here a . b = 2(1) + 2(2) + 6(2) = 18 and b . b = 1^2 + 2^2 + 2^2 = 9, giving scale factor k = 18 / 9 = 2. Multiplying (1, 2, 2) by 2 returns the effective rail force (2, 4, 4) kN.

The calculator outputs the projected vector proj_b(a) as an ordered Cartesian triple (px, py, pz). Because proj_b(a) = k * b where k = (a . b) / (b . b), the output vector lies along the infinite line spanned by your target vector b:
Multiplier sign and orientation: When k > 0 (acute angle theta < 90°), both proj_b(a) and b point along the same forward ray because the dot product a . b is positive. When k = 0 (right angle theta = 90°), the output is (0, 0, 0), proving orthogonality. When k < 0 (obtuse angle theta > 90°), a negative dot product flips the projection 180° so that it points antiparallel to b.
Orthogonal rejection verification: Subtract the output triple from your first vector a to form the orthogonal rejection a_perp = a - proj_b(a). Entering a_perp and b into the Dot Product Calculator must return 0 (for example, in the 3D rail case above, (2, 2, 6) - (2, 4, 4) = (0, -2, 2), and 0(1) + (-2)(2) + 2(2) = 0).

Keep these three mathematical properties in mind before exporting your coordinates:
Direction order and non-zero target guard: Vector projection is not commutative (proj_b(a) != proj_a(b)). First vector is always the vector being projected (a), and Second vector is always the target line (b). Setting all three coordinates of Second vector to 0 triggers 'Target vector cannot be zero.', whereas scaling Second vector by any non-zero constant leaves proj_b(a) unchanged.
Compute the numerator a . b in the Dot Product Calculator, find vector lengths in the Vector Magnitude Calculator, measure the angle in the Vector Angle Calculator, convert b into a unit vector in the Vector Normalizer, subtract proj_b(a) from a in the Vector Linear Combination Calculator, or find normal vectors and clearances in the Cross Product Calculator and Point to Line Distance Calculator.


Use this dot product calculator and vector dot product calculator to compute the scalar product of two 3D or 2D vectors (x·u + y·v + z·w) in your browser.
Open tool
Calculate the Euclidean length of any 2D or 3D vector with our free vector magnitude calculator. Enter X, Y, and Z components for instant, exact results.
Open tool
Find the interior angle between two 2D or 3D vectors in degrees with our free vector angle calculator. Includes cosine formula, examples, and lookup table.
Open toolChoose another tool for your next calculation, conversion, or text task.

Normalize any nonzero 2D or 3D vector into a unit vector of length 1 with our free vector normalizer. Enter x, y, z components for exact browser results.
Open toolCombine equally sized vectors using one supplied coefficient per vector.
Open tool
Use this free cross product calculator to find the right-handed 3D vector product a × b = (yw - zv, zu - xw, xv - yu) for physics torque and surface normals.
Open tool
Find perpendicular distance from a point to Ax + By + C = 0.
Open toolAnswers about using Vector Projection Calculator and understanding its results.
The orthogonal projection of a = (x, y, z) onto a non-zero vector b = (u, v, w) is proj_b(a) = ((a . b) / (b . b)) * b. Compute the dot product xu + yv + zw, divide it by the squared length u^2 + v^2 + w^2 of the target vector b, and multiply each component of b by that scalar ratio.
The scalar projection (comp_b(a) = (a . b) / ||b|| = ||a|| cos(theta)) is a single signed number that gives the signed length of a's shadow along b. The vector projection proj_b(a) multiplies that signed length by the unit direction vector b / ||b||, returning a full 3-component vector (px, py, pz).
The preloaded vectors a = (1, 0, 0) and b = (0, 1, 0) lie along the perpendicular x and y axes (90 degrees apart). Because their dot product is 1(0) + 0(1) + 0(0) = 0, the scale multiplier k = 0 / 1 is zero, so the projection onto the y-axis is the zero vector (0, 0, 0).
Once you calculate the parallel projection a_parallel = proj_b(a), subtract its coordinates from your original vector a: a_perp = a - proj_b(a). This rejection vector is strictly perpendicular to b and represents the normal force component or Gram-Schmidt orthogonal basis step, which you can compute in the Vector Linear Combination Calculator.
Projecting a zero vector a = (0, 0, 0) onto a valid line b gives (0 / (b . b)) * b = (0, 0, 0). However, if the target vector b is (0, 0, 0), it has no line of direction and its squared norm b . b is 0, causing division by zero and triggering 'Target vector cannot be zero.'
Choose another tool for your next calculation, conversion, or text task.