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

Dot Product Calculator (Scalar Product)

Find the dot product of two vectors from components (2 to 12 dimensions) or from lengths and angle, with both magnitudes, cos θ, the angle and orthogonality.

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 a · b, carrying the product of the input units (newtons times metres gives joules); its sign shows whether the vectors lean together or apart.
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.

Every till receipt is a dot product. Three items at $2.50, $1.20 and $4.00, bought in quantities of 3, 5 and 2, cost 2.50 × 3 + 1.20 × 5 + 4.00 × 2 = $21.50: multiply matching entries, add the results, and one number is left. Written as vectors, that is (2.5, 1.2, 4) · (3, 5, 2) = 21.5.

What makes the same arithmetic central to geometry and physics is that it also measures direction. For two arrows in space, a · b equals the length of a times the length of b times the cosine of the angle between them. Coordinates go in and an angle comes out, with no drawing and no protractor. The sign sorts most cases on its own: positive when the vectors point broadly the same way, negative when they point broadly apart, and exactly zero when they are perpendicular, which makes the dot product the standard test for a right angle in any number of dimensions.

You can come at it from either side. Give the components of both vectors, anything from 2 to 12 numbers each, and you get the dot product, both lengths, cos θ, the angle and a one-line verdict: parallel, antiparallel, orthogonal, acute or obtuse. Or give two lengths and the angle between them and get the dot product from |a| |b| cos θ. Physics students meet that second form as work, force times distance times the cosine of the angle between them; graphics programmers meet it as the brightness of a surface lit at a slant; search engines use the cosine on its own to judge how alike two documents are.

What is dot product calculator?

The dot product, also called the scalar product or, for ordinary real vectors, the inner product, takes two vectors with the same number of components and returns a single number: a · b = a₁b₁ + a₂b₂ + … + aₙbₙ. Geometrically it equals |a| |b| cos θ, where θ is the angle between the vectors, between 0° and 180°. It is commutative (a · b = b · a), it distributes over addition, and a number multiplying either vector can be pulled outside. It is not associative, since a · b is a scalar and cannot be dotted with a third vector. Dotting a vector with itself gives its length squared, and two non-zero vectors are orthogonal exactly when their dot product is zero. The Cauchy–Schwarz inequality, |a · b| ≤ |a| |b|, is what keeps the cosine between −1 and 1. Unlike the cross product, which works only in three and seven dimensions, the dot product is defined in every dimension.

How to use this calculator.

  1. Under What do you have?, choose the components of both vectors, or both magnitudes and the angle between them. The fields for the other choice are ignored.
  2. For components, type each vector's numbers separated by commas, spaces or semicolons, such as 3, -2, 5. Both vectors need the same count, from 2 to 12, and each number must lie within ±1,000,000,000,000. Decimals and scientific notation like 2.5e-3 are fine.
  3. For magnitudes and angle, enter |a| and |b|, both greater than zero, and the angle in degrees from 0° to 180°. A bearing such as 250° between two directions is really 110° between the vectors, since the angle is always measured the short way round.
  4. Read the dot product first, then the verdict beside it. If you expected a right angle and the verdict says obtuse, a sign has probably slipped in one of the components.
  5. Swapping a and b changes nothing, so order the vectors however is convenient. If you want the angle between two lines rather than two arrows, take the smaller of θ and 180° − θ: the example vectors meet at 122.0727°, so the lines through them cross at 57.9273°.
  6. To check a result, carry it across modes: entering the example's lengths 6.1644 and 4.5826 with an angle of 122.0727° returns a dot product of −15.0001, the original −15 apart from the rounding of the inputs.

The formula.

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

With components, the dot product is the sum Σ aᵢbᵢ. The lengths come from the same kind of sum, |a| = √(Σ aᵢ²) and |b| = √(Σ bᵢ²), which is Pythagoras extended to n dimensions. Dividing gives cos θ = a · b ÷ (|a| |b|), and θ = arccos of that ratio. The arccosine is the right inverse to use because cosine runs one-to-one from 1 down to −1 as the angle goes from 0° to 180°, exactly the range an angle between two vectors can take, so every cosine maps back to one angle.

Why should a sum of products know anything about angles? Expand the squared length of a − b: |a − b|² = |a|² + |b|² − 2 a · b. The law of cosines says the same side of the triangle formed by a and b is |a|² + |b|² − 2|a| |b| cos θ. Set the two equal and a · b = |a| |b| cos θ falls out. For the worked example, a − b = (2, −6, 7), whose squared length 89 equals 38 + 21 + 30, as the identity requires.

With magnitudes and an angle, the calculation runs the other way: cos θ comes from the angle and a · b = |a| |b| cos θ. Lengths of 5 and 8 at 60° give 5 × 8 × 0.5 = 20.

The verdict is read from the unrounded cosine. A cosine within 10⁻¹² of 1 counts as parallel, within 10⁻¹² of −1 as antiparallel, and within 10⁻¹² of zero as orthogonal; anything else is acute or obtuse by its sign. Because the test uses the cosine rather than the raw dot product, it does not depend on how long the vectors are. The band is extremely narrow, so orthogonal and parallel verdicts appear only for exact or nearly exact data; measured vectors that are perpendicular to within a fraction of a degree will be labelled acute or obtuse, and the angle shows how close they came.

A worked example.

Example

Take a = (3, −2, 5) and b = (1, 4, −2). Multiply matching components: 3 × 1 = 3, −2 × 4 = −8 and 5 × −2 = −10, so a · b = 3 − 8 − 10 = −15. The lengths are |a| = √(9 + 4 + 25) = √38 = 6.1644 and |b| = √(1 + 16 + 4) = √21 = 4.5826, whose product is √798 = 28.2489. Dividing, cos θ = −15 ÷ 28.2489 = −0.531, and the angle is arccos(−0.531) = 122.0727°. The negative dot product had already said the angle was obtuse before any square roots were taken; the verdict confirms it. The same −15 also measures how far a reaches along b's line. Divided by |b|, it gives a scalar projection of −3.2733: a's shadow on that line points backwards, opposite to b, by about 3.27 units. Divided by |b|² = 21 instead, it gives the multiple of b that forms that shadow, −5/7 of b, the vector (−0.7143, −2.8571, 1.4286).

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

Frequently asked questions.

What does a negative dot product tell me about two vectors?
That the angle between them is greater than 90°. The lengths |a| and |b| are always positive, so the sign of a · b is the sign of cos θ, and the cosine is negative for every angle between 90° and 180°. In the worked example −15 signals an obtuse angle immediately, and the full calculation puts it at 122.0727°.
How do I check whether two vectors are perpendicular?
Compute the dot product and see whether it is zero. For (4, 3) and (−3, 4) it is 4 × −3 + 3 × 4 = 0, so they meet at a right angle with no trigonometry needed. With measured or rounded data you will rarely get exactly zero, so judge by cos θ: a cosine of 0.0175 corresponds to an angle about one degree away from 90°.
How is the dot product used to calculate work in physics?
Work is force dotted with displacement, W = F · d = |F| |d| cos θ. Pulling a sled 10 m with a 50 N force angled 30° above the ground does 50 × 10 × cos 30° = 433.01 J of work. Push at right angles to the motion and cos 90° = 0, so no work is done; push against the motion and the work is negative.
How do I find the projection of one vector onto another?
Divide the dot product by the length of the vector you are projecting onto. That gives the scalar projection, how far a reaches along b. For the vector projection, divide by |b|² instead and multiply b by the result. In the worked example the scalar projection is −15 ÷ 4.5826 = −3.2733, and the vector projection is −5/7 of b.
How is the dot product different from the cross product?
The dot product returns a number and is built on the cosine; the cross product returns a vector perpendicular to both inputs and is built on the sine. The dot product is largest for parallel vectors and zero for perpendicular ones, while the cross product does the reverse. Swapping the inputs leaves a dot product unchanged but reverses a cross product, and the dot product works in any dimension.
Can I take the dot product of vectors with more than three components?
Yes. The definition is the same in any dimension: multiply matching components and add. Up to 12 components can be entered here, and the angle it reports is meaningful in higher dimensions too, because |a| |b| cos θ holds there just as it does in three. For longer lists, a spreadsheet's SUMPRODUCT function computes the same sum.
What is cosine similarity, and why does it ignore vector length?
It is cos θ used as a score of how alike two lists of numbers are, common for comparing documents by word counts. Because it divides by both lengths, only proportions matter. Word counts of (2, 1, 0, 3) and (4, 2, 0, 6) score exactly 1, the same mix at twice the length, while (2, 1, 0, 3) against (0, 1, 5, 0) scores 0.0524, almost unrelated.
Why is the zero vector not accepted?
Its dot product with anything is zero, but it has no direction, so the angle between it and another vector does not exist and the cosine would mean dividing by zero. Rather than show an angle that means nothing, the calculator asks for a non-zero vector. In the magnitudes mode the same rule appears as both lengths having to be greater than zero.
Why does a vector dotted with itself give its length squared?
Because a · a adds up the squares of the components, which is exactly what Pythagoras squares and sums to find a length. For a = (3, −2, 5), a · a = 9 + 4 + 25 = 38, and the length is √38 = 6.1644. It is also why every vector makes an angle of 0° with itself: the cosine is 38 ÷ 38 = 1.
Can I use this for a weighted total, such as a course grade?
Yes, and the dot product is the answer you want. Weights of 0.2, 0.3 and 0.5 on scores of 80, 70 and 90 give 0.2 × 80 + 0.3 × 70 + 0.5 × 90 = 82. The angle and verdict are still calculated, but for a weighted sum they have no practical meaning, so read only the dot product.

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.

How this page was produced

Published by
Quanta Calculator
Primary sources
5 cited below
Method
a · b = a₁b₁ + a₂b₂ + … + aₙbₙ = |a| |b| cos θ
Published
Last verified

Built with AI assistance and verified by automated tests against the cited sources — every worked example on this page is computed by the same code that runs the calculator. How we build and check calculators.

In this category

Embed

Quanta Pro

Paid features are coming later.

  • All 1560 calculators remain free
  • No billing is enabled
Coming soon