Dot Product Calculator (Scalar Product)
Compute a·b from components in any dimension, or from magnitudes and the included angle. Returns both magnitudes, cos θ, the angle and an orthogonality check.
Dot Product Calculator
Background.
This dot product calculator multiplies two vectors and returns the scalar a·b along with everything that follows from it: both magnitudes, the cosine of the angle between the vectors, the angle itself in degrees, and a plain-language verdict on whether they are parallel, perpendicular or somewhere in between. Two modes cover the two ways the question is usually asked. Give it the components of both vectors and it sums the products term by term. Give it the two magnitudes and the included angle instead and it uses a·b = |a| |b| cos θ. Both routes produce the same complete set of answers.
The dot product is the simplest way to multiply two vectors and by far the most used. Multiply matching components and add: for a = (3, −2, 5) and b = (1, 4, −2) that is 3×1 plus −2×4 plus 5×−2, which comes to −15. The result is a single number, not a vector, which is why it is also called the scalar product. That number has a clean geometric meaning — it equals the length of a, times the length of b, times the cosine of the angle between them — and the fact that these two very different-looking calculations always agree is one of the genuinely useful theorems in elementary vector algebra. It means you can compute an angle from raw coordinates without drawing anything, and you can compute a projection without any trigonometry.
The sign alone carries most of the practical information. A positive dot product means the angle is less than 90° and the vectors point broadly the same way. A negative dot product, like the −15 above, means the angle exceeds 90° and they point broadly apart. Exactly zero means exactly perpendicular, and this is the standard test for orthogonality throughout mathematics, physics and computer graphics — it is far cheaper and far more reliable than computing an angle and comparing it to 90°, because it needs no trigonometry and no tolerance. In physics the dot product is what turns force and displacement into work, which is why pushing perpendicular to the direction of travel does no work at all: the cosine is zero, so the dot product is zero.
Unlike the cross product, the dot product is defined in every dimension. Two-component vectors, three-component vectors, and the thousand-component vectors that represent documents in a search engine all use the same formula, and the geometric identity keeps working: cos θ is the dot product of the two vectors after each has been scaled to unit length, no matter how many components they have. This page accepts anything from 2 to 12 components. It is also commutative — a·b and b·a are the same number — which is a real difference from the cross product, where swapping the operands flips the answer's sign.
One input is refused rather than answered, and the reason is worth stating up front. If either vector has zero length, the dot product is legitimately zero, but the angle between a direction and something that has no direction does not exist. Since this page reports an angle, it declines the zero vector and explains why instead of returning a sensible-looking zero next to a meaningless one. In the magnitudes-and-angle mode the same principle applies: both magnitudes must be strictly positive, and the angle must lie between 0° and 180°, which is the whole range an angle between two vectors can occupy.
One small piece of numerical care is worth knowing about. For two genuinely parallel vectors the ratio (a·b)/(|a||b|) should be exactly 1, but floating-point arithmetic can nudge it to 1.0000000000000002, and the arccosine of a number greater than 1 is undefined. This calculator clamps the value passed to arccos into the interval from −1 to 1 so the angle comes back as 0° rather than as an error, while the cosine it reports and the classification it makes both use the unclamped value — so the clamp can never change an answer, only prevent a crash.
What is dot product calculator?
The dot product, also called the scalar product or inner product, of two vectors a and b with the same number of components is the sum of the products of their matching components: a·b = a₁b₁ + a₂b₂ + … + aₙbₙ. It returns a scalar, not a vector. It is equivalently given by the geometric formula a·b = |a| |b| cos θ, where |a| and |b| are the lengths of the vectors and θ is the angle between them, measured from 0° to 180°. Rearranging gives cos θ = (a·b)/(|a| |b|) and θ = arccos[(a·b)/(|a| |b|)], the standard route from coordinates to an angle. The dot product is commutative (a·b = b·a), distributive over vector addition, and compatible with scalar multiplication, but it is not associative because a·b is a scalar and cannot be dotted with a third vector. Two non-zero vectors are orthogonal — perpendicular — if and only if their dot product is zero, which is the definition of orthogonality used throughout linear algebra. The dot product of a vector with itself gives the square of its length, a·a = |a|², so |a| = √(a·a). The Cauchy–Schwarz inequality |a·b| ≤ |a| |b| guarantees that the cosine computed from it always falls between −1 and +1. Unlike the cross product, which exists only in three dimensions and in seven, the dot product is defined in every dimension.
How to use this calculator.
- Choose whether you have the components of both vectors or their magnitudes and the angle between them.
- In components mode, type each vector's components separated by commas or spaces. Both vectors need the same number of components, anywhere from 2 to 12.
- In magnitudes-and-angle mode, enter both lengths and the included angle in degrees, anywhere from 0° to 180°.
- Read the dot product at the top. Its sign is the quickest thing to interpret: positive for broadly aligned, negative for broadly opposed, exactly zero for perpendicular.
- Read the angle for the exact separation between the two vectors.
- Read cos θ if you want the scale-free measure — it is the dot product of the two vectors after each has been normalised to unit length, so it depends only on direction and not on length.
- Use the relationship line as a sanity check on your input: if you expected perpendicular vectors and it says obtuse, one of your components probably has the wrong sign.
- Order does not matter here — a·b equals b·a. That is a real difference from the cross product, where swapping the vectors flips the sign.
The formula.
In components mode the calculator multiplies matching entries and adds them up: a·b = Σ aᵢbᵢ. It also accumulates Σ aᵢ² and Σ bᵢ² along the way, whose square roots are the two magnitudes, since a·a = |a|². Dividing the dot product by the product of the magnitudes gives cos θ, and the arccosine of that gives the angle. The arccosine is the right inverse to use here, and not by accident: cosine is one-to-one across the whole interval from 0° to 180°, which is exactly the range an angle between two vectors can occupy, so no information is lost and the sign of the dot product already places the angle in the correct half. That is a genuine difference from the cross-product page on this site, where the natural ratio is a sine — and sine is not one-to-one on that interval, so arcsine cannot tell 45° from 135° and an atan2 formulation is needed instead. In magnitudes-and-angle mode the calculation runs the other way: cos θ comes straight from the angle, and the dot product is |a| times |b| times that cosine, so 5 and 8 at 60° give 5 × 8 × 0.5 = 20 exactly. Rounding happens once, at the very end. All arithmetic runs at 40 significant digits and results are rounded to 10 decimal places only at the return boundary. One clamp is applied and its scope matters: the argument handed to arccos is limited to the interval from −1 to 1, because floating error can push the ratio for genuinely parallel vectors to 1 + 1e-17 and arccos of that is undefined. The cosine that is reported and the cosine used to classify the relationship are both the unclamped values, so the clamp cannot change an answer — it only stops a NaN. The parallel, antiparallel, orthogonal, acute and obtuse verdicts are all decided from that unrounded cosine against a tolerance of 1e-12, so no displayed value takes part in the classification.
A worked example.
Take a = (3, −2, 5) and b = (1, 4, −2). Multiplying matching components and adding gives a·b = 3(1) + (−2)(4) + 5(−2) = 3 − 8 − 10 = −15. The magnitudes are |a| = √(9 + 4 + 25) = √38 ≈ 6.164414003 and |b| = √(1 + 16 + 4) = √21 ≈ 4.582575695, so their product is √798 ≈ 28.2488937837. The cosine of the angle is therefore −15 / 28.2488937837 ≈ −0.5309942441, and the angle itself is arccos(−0.5309942441) ≈ 122.0726565341°. The negative dot product told us before any trigonometry that the angle had to exceed 90°, and 122.07° duly does. Feeding those three numbers — 6.164414003, 4.582575695 and 122.0726565341° — back into the magnitudes-and-angle mode reproduces a·b = −15, which is the round-trip check the test suite performs on the calculator's own output. For a cleaner second example in that mode, two vectors of length 5 and 8 separated by 60° have a dot product of 5 × 8 × cos 60° = 5 × 8 × 0.5 = 20 exactly, and the verdict is acute because the angle is under 90°.
Frequently asked questions.
How do you calculate the dot product of two vectors?
What does a negative dot product mean?
What does a dot product of zero mean?
How do you find the angle between two vectors using the dot product?
What is the difference between the dot product and the cross product?
Can you take the dot product of vectors that are not 3D?
Why is cos θ always between −1 and 1?
What is the dot product used for in physics?
References& sources.
- [1]OpenStax, Calculus Volume 3, §2.3 "The Dot Product" — component definition u·v = u₁v₁ + u₂v₂ + u₃v₃, the geometric theorem u·v = ‖u‖‖v‖ cos θ, the orthogonality criterion (non-zero u and v are orthogonal if and only if u·v = 0), and the angle formula θ = arccos[(u·v)/(‖u‖‖v‖)]. Retrieved 2026-07-29; open access.
- [2]Wolfram MathWorld, "Dot Product" — independent statement of the general n-dimensional component sum X·Y = Σᵢ xᵢyᵢ, the relation X·Y = |X||Y| cos θ, and the perpendicularity consequence. Used as the second authority, and as the basis for accepting more than three components. Retrieved 2026-07-29; open access.
- [3]OpenStax, Calculus Volume 3, §2.4 "The Cross Product" — source of the contrast drawn on this page between the scalar and vector products, including the sine relation and the three-dimensional restriction. Retrieved 2026-07-29; open access.
- [4]MIT OpenCourseWare, 18.06 Linear Algebra (Spring 2010), G. Strang — Unit I covers inner products, lengths and orthogonality. Retrieved 2026-07-29; open access.
- [5]Strang, G. (2016). Introduction to Linear Algebra, 5th ed., Wellesley–Cambridge Press. §1.2 "Lengths and Dot Products" — the dot product, the Schwarz inequality |a·b| ≤ |a||b| that bounds the cosine to [−1, 1], and the cosine formula. The book itself is print; the linked author page at MIT lists the 5th (2016) and 6th (2023) editions and is where the companion material lives. Retrieved 2026-07-29.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 977 calculators remain free
- No billing is enabled