Skip to content

Dot Product Calculator

Enter two 2D or 3D vectors to find their scalar dot product and the angle between their directions.

Enter vector components

Your data stays in this browser.

Dimensions
Vector A
Vector B

Result

Enter the components, then select Calculate.

How to use the dot product calculator

Use this calculator when you know the Cartesian components of two vectors. It keeps the scalar product and the angle as separate results, because a zero vector has a valid dot product but no direction.

  1. Choose 2D or 3D. In 2D, only x and y take part in the calculation.
  2. Enter every component of vector A and vector B. Negative values, zero, decimals, and scientific notation are accepted.
  3. Select Calculate to evaluate the current values.
  4. Read the dot product, both vector magnitudes, and the angle in degrees and radians.
  5. Use Copy result to copy the displayed calculation. Clear beside A or B removes only that vector’s components, while also invalidating the old result and copy state.

What the dot product tells you

For A = (a₁,a₂,a₃) and B = (b₁,b₂,b₃), the dot product is A · B = a₁b₁ + a₂b₂ + a₃b₃. A 2D calculation simply omits the third term. The answer is a scalar, not another vector.

A positive value means the vectors point generally toward the same side, a negative value means they point more than 90° apart, and zero means nonzero vectors are perpendicular. A zero dot product alone does not prove perpendicular directions when either vector is the zero vector.

How the angle is calculated

For two nonzero vectors, cos θ = (A · B)/(|A||B|). The calculator uses the Euclidean magnitudes and clamps the computed cosine to the interval from −1 to 1 before applying arccos, which avoids a false domain error from tiny floating-point residue.

The returned angle is the smaller unsigned angle from 0° through 180°. Degrees and radians describe the same angle. If either magnitude is zero, the dot product is still shown—always zero—but the angle is explicitly marked undefined because the zero vector has no direction.

Uses, limits, and common mistakes

  • Check orthogonality in geometry, coordinate work, or linear algebra by looking for a zero dot product between nonzero vectors.
  • Compare alignment: parallel same-direction vectors give 0°, while opposite-direction vectors give 180°.
  • Mechanical work may be modeled by a force–displacement dot product, but this page only performs the vector calculation and does not attach physical units.
  • Do not paste parentheses, commas, i/j/k notation, or an expression into one field; enter one numeric component per field.
  • Results show at most two decimal places while calculations retain JavaScript numeric precision. This is a practical calculator, not an arbitrary-precision engine.

Worked examples

A = (3,4) and B = (5,2): A · B = 3×5 + 4×2 = 23. Their magnitudes are 5 and √29, so the angle is about 31.33° (0.55 rad).

A = (2,3) and B = (−3,2): A · B = −6 + 6 = 0. Both vectors are nonzero, so the angle is 90° (1.57 rad).

A = (0,0,0) and B = (1,2,3): the dot product is 0, but the angle is undefined.

Frequently asked questions

Is the dot product a vector?

No. The dot product of two vectors is one scalar number.

Why is the angle undefined when the dot product is zero?

It is undefined only when at least one vector is zero. Two nonzero vectors with dot product zero have a 90° angle.

Does swapping A and B change the answer?

No. A · B equals B · A, and the angle is unchanged.

Can I calculate both 2D and 3D vectors?

Yes. Choose the dimension before calculating; the z fields appear only in 3D.

Why are long decimals shortened?

The display uses at most two decimal places to avoid floating-point residue. The calculation uses the unrounded numbers internally.