Dot Product Calculator
Find the dot product of two vectors in your browser. See the scalar result, each vector's magnitude, the cosine, and the angle between them — with the full element-wise working behind every number. No signup, nothing uploaded.
How it works
The dot product (also called the scalar product or inner product) takes two vectors of the same length and returns a single number. It is the sum of the products of matching components, and it underpins cosine similarity, projections, and most of the geometry used in machine learning. The definitions below follow Wolfram MathWorld and standard linear algebra.
For two equal-length vectors A = [a₁…aₙ] and B = [b₁…bₙ]:
A · B = Σ aᵢbᵢ = a₁b₁ + a₂b₂ + … + aₙbₙ
The tool computes the result and its geometry in four steps:
- Dot product. Multiply the vectors component by component and add the results:
A · B = Σ aᵢbᵢ. This single number is the scalar product. - Magnitudes.Take the square root of each vector's sum of squares:
‖A‖ = √(Σ aᵢ²)and likewise for‖B‖— the Euclidean magnitude, or L2 norm. - Cosine of the angle. Rearranging the geometric identity
A · B = ‖A‖‖B‖cosθgivescosθ = (A·B)/(‖A‖·‖B‖). This is defined only when both magnitudes are non-zero; a zero vector has no direction, so the tool shows a clear note instead of dividing by zero. - Angle. The angle is
θ = arccos(cosθ), shown in degrees and radians. The cosine is clamped to [−1, 1] first so floating-point drift never produces an invalid arccos.
The sign of the dot product alone tells you the kind of angle: positive means acute (the vectors broadly agree), zero means orthogonal (perpendicular, a right angle), and negative means obtuse, up to exactly opposite at 180°. As a credibility check, the calculator also recovers the dot product a second, independent way — the polarisation identity A·B = (‖A+B‖² − ‖A‖² − ‖B‖²)/2, which never multiplies aᵢ by bᵢ — and confirms the two routes agree. The dot product is the numerator of cosine similarity, so the cosine similarity and Euclidean distance tools linked below sit in the same family.
Worked examples
Frequently asked questions
Sources & references
- Wolfram MathWorld — Dot Product: A·B = Σ aᵢbᵢ, the identity A·B = ‖A‖‖B‖cosθ, and the orthogonality condition
- Wolfram MathWorld — L2-Norm: the Euclidean magnitude ‖a‖ = √(Σ aᵢ²) used for the magnitudes and angle
- NIST Digital Library of Mathematical Functions — standard reference for the inner product and vector norm
The formulas on this page were last cross-checked against these sources on 2026-06-10. The dot product is a stable mathematical definition, so this tool needs no rate or schedule updates — only the worked examples are periodically re-reconciled.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a bug, edge case, or want to suggest an improvement?
Email me at [email protected] — most fixes ship within 24 hours.