Audited 29 Jul 2026·Last updated 31 Jul 2026·5 citations·Tier 1·0 uses

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

What do you have?
Components separated by commas or spaces. Any dimension from 2 to 12 — the dot product is not limited to 3D.
Must have the same number of components as vector a.
Used only in the magnitudes-and-angle mode. Must be greater than zero.
Used only in the magnitudes-and-angle mode.
Used only in the magnitudes-and-angle mode. The angle between two vectors runs from 0° to 180°.
°
a · b
-15
The scalar product. Positive means the vectors point broadly the same way, negative means broadly opposite, and exactly zero means perpendicular. Its unit is the product of the two input units — newtons dotted with metres gives joules.
Angle between a and b
122.0727°
cos θ
-0.531
Relationship
Obtuse — the angle is greater than 90°, so the vectors point broadly in opposite directions
|a|
6.1644
|b|
4.5826

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.

  1. Choose whether you have the components of both vectors or their magnitudes and the angle between them.
  2. 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.
  3. In magnitudes-and-angle mode, enter both lengths and the included angle in degrees, anywhere from 0° to 180°.
  4. 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.
  5. Read the angle for the exact separation between the two vectors.
  6. 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.
  7. 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.
  8. 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.

a · b = a₁b₁ + a₂b₂ + … + aₙbₙ = |a| |b| cos θ

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.

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°.

modecomponents
vector A3, -2, 5
vector B1, 4, -2

Frequently asked questions.

How do you calculate the dot product of two vectors?
Multiply the matching components and add the results. For a = (3, −2, 5) and b = (1, 4, −2), that is 3×1 = 3, then −2×4 = −8, then 5×−2 = −10, and 3 − 8 − 10 = −15. The answer is a single number, not a vector. If you have the magnitudes and the angle instead of components, use a·b = |a| |b| cos θ — the two routes always agree, which is the whole point of the geometric identity.
What does a negative dot product mean?
It means the angle between the two vectors is greater than 90°, so they point broadly in opposite directions. The reason is the geometric formula: |a| and |b| are always positive, so the sign of a·b is entirely the sign of cos θ, and the cosine is negative for every angle between 90° and 180°. In the worked example a·b = −15, which immediately tells you the angle exceeds 90° without computing anything else — and it turns out to be about 122.07°.
What does a dot product of zero mean?
For two non-zero vectors it means they are exactly perpendicular. This is the standard definition of orthogonality: OpenStax states that non-zero vectors u and v are orthogonal if and only if u·v = 0. It is the test everyone uses in practice because it needs no trigonometry, no square roots and no tolerance — you just check whether a sum of products came out zero. The zero vector is a special case: it dots to zero with everything, but the angle between it and another vector is undefined, which is why this calculator refuses it rather than reporting a meaningless angle.
How do you find the angle between two vectors using the dot product?
Rearrange the geometric formula: cos θ = (a·b)/(|a| |b|), so θ = arccos[(a·b)/(|a| |b|)]. Compute the dot product, compute both lengths as the square roots of the sums of squared components, divide, and take the arccosine. For the worked example, −15 divided by √38 × √21 = √798 ≈ 28.2489 gives cos θ ≈ −0.53099, and arccos of that is about 122.07°. The result always lands between 0° and 180°, which is the full range an angle between two vectors can occupy.
What is the difference between the dot product and the cross product?
The dot product returns a number and is built on the cosine; the cross product returns a vector and is built on the sine. The dot product measures how much two vectors point the same way and is zero when they are perpendicular. The cross product measures how much they fail to point the same way and is zero when they are parallel. The dot product is commutative and works in any number of dimensions; the cross product is anticommutative, so swapping the operands flips the sign, and it only exists as a vector-valued operation in three dimensions and in seven.
Can you take the dot product of vectors that are not 3D?
Yes — the dot product is defined in every dimension, which is one of its main advantages over the cross product. The formula is the same: multiply matching components and add. Two-dimensional vectors work, and so do the very high-dimensional vectors used in machine learning and information retrieval, where the normalised dot product of two document or embedding vectors is called cosine similarity. This calculator accepts from 2 up to 12 components, and the geometric identity a·b = |a| |b| cos θ holds for all of them.
Why is cos θ always between −1 and 1?
Because of the Cauchy–Schwarz inequality, which says |a·b| ≤ |a| |b| for any two vectors. Dividing both sides by |a| |b| bounds the ratio to between −1 and +1, so it is always a legitimate cosine. In exact arithmetic the ratio can never escape that range. In floating-point arithmetic it can drift a hair outside it for genuinely parallel vectors — 1.0000000000000002 rather than 1 — and the arccosine of that is undefined, which is why this calculator clamps the value it passes to arccos. The cosine it reports and the relationship it decides both use the unclamped value, so the clamp only ever prevents an error; it never changes a result.
What is the dot product used for in physics?
The clearest example is work. Work equals force dotted with displacement, W = F·d = |F| |d| cos θ, and the cosine is exactly what accounts for the direction of the push. Pushing straight along the direction of travel gives cos 0° = 1 and the full |F| |d|. Pushing at right angles to the motion gives cos 90° = 0 and no work at all, which is why carrying a suitcase horizontally at constant speed does no work on it despite the effort. Pushing backwards gives a negative cosine and negative work, meaning energy is taken out of the system rather than put in. The same structure appears in power as force dotted with velocity, and in electrical and magnetic flux.

References& sources.

  1. [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. [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. [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. [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. [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
Coming soon