Dot Product Calculator
Dot Product Calculator
This calculator computes the dot product of two vectors — a single number that measures how much the vectors point in the same direction. Enter two 2D or 3D vectors and you get the dot product, the angle between them, their magnitudes, and whether they are perpendicular or parallel.
The dot product is one of the most useful operations in mathematics and physics, and it shows up in deceptively ordinary places. When you push a shopping cart at an angle, only the part of your force pointing along the cart's motion does useful work — that part is exactly a dot product. When a pilot wants to know whether a crosswind is blowing her off course, she is comparing wind direction to the runway direction. When a computer checks whether two surfaces are lit the same way, it computes a dot product between light and surface vectors. The operation is a workhorse precisely because it turns "how much are these two things aligned?" into a single number[wikipedia-dot-product][mathworld-dot-product].
This page is the dedicated tool for the "dot product calculator" intent. The Vector Calculator covers dot and cross products among many vector operations; this page leads with the dot product itself, shows the angle and the relationship explicitly, and focuses on the two most common cases: 2D and 3D vectors.
Pick 2D or 3D, enter the components of each vector, and the results update instantly.
- Choose the dimension — 2D uses (x, y), 3D adds z. The formula and interpretation are identical; only the input shape changes.
- Enter vector a — e.g.
(1, 2, 3)for 3D. Use negative values freely (-5is a perfectly normal component). - Enter vector b — e.g.
(4, -5, 6). - Read the results — the two featured cards show the dot product and the angle between the vectors. Below them: each vector's magnitude, and the relationship (orthogonal, parallel, or neither).
Example 1 — a typical 3D pair. a = (1, 2, 3), b = (4, −5, 6). Dot product: 1·4 + 2·(−5) + 3·6 = 4 − 10 + 18 = 12. Magnitudes: |a| = √14 ≈ 3.742, |b| = √77 ≈ 8.775. Angle: cos θ = 12/(3.742 × 8.775) ≈ 0.365, so θ ≈ 68.56° — the vectors point roughly the same way, but not very strongly.
Example 2 — perpendicular vectors. a = (1, 0), b = (0, 1). Dot product: 1·0 + 0·1 = 0. Two nonzero vectors are orthogonal (perpendicular) exactly when their dot product is zero[wikipedia-dot-product]. The angle is 90°.
Example 3 — parallel vectors. a = (2, 3), b = (4, 6). Notice b = 2a. Dot product: 2·4 + 3·6 = 8 + 18 = 26. Angle: 0° — the vectors point in the same direction. Vectors are parallel when one is a scalar multiple of the other[lamar-dot-product].
Component form (the way the calculator does it) — multiply corresponding components and add:
Geometric form — the same number expressed through the angle:
Angle between the vectors (rearranging the geometric form):
Magnitude (Euclidean norm) of a vector:
The result of a dot product is a scalar — a single number, not a vector. That is the defining difference from the cross product, which returns a vector perpendicular to both inputs[mathworld-dot-product].
Why the two forms are the same: the Law of Cosines
The connection between "add the products of components" and "multiply magnitudes by the cosine" is not obvious. It comes from the Law of Cosines. Expand the squared distance between the two vectors:
But geometry says the same length is |a|² + |b|² − 2|a||b|cos θ. Equating the two expressions for |a−b|² gives a·b = |a||b|cos θ — the geometric form drops straight out of the component definition[libretexts-dot-product][mit-ocw-linalg]. This is why the dot product's sign has a meaning you can trust: positive means the vectors point in the same general direction (θ < 90°), zero means perpendicular (θ = 90°), negative means opposite (θ > 90°)[khan-dot-product].
Let's compute this one by hand, step by step.
Step 1 — multiply corresponding components.
- a₁b₁ = 1 × 4 = 4
- a₂b₂ = 2 × (−5) = −10
- a₃b₃ = 3 × 6 = 18
Step 2 — add them up. 4 + (−10) + 18 = 12. That is the dot product.
Step 3 — find the magnitudes.
- |a| = √(1² + 2² + 3²) = √14 ≈ 3.7417
- |b| = √(4² + (−5)² + 6²) = √77 ≈ 8.7750
Step 4 — compute the angle. cos θ = 12 / (3.7417 × 8.7750) ≈ 12 / 32.83 ≈ 0.3655, so θ ≈ arccos(0.3655) ≈ 68.56°. The calculator returns all four of these numbers directly.
The table shows canonical vector pairs and their results, so you can verify the calculator and build intuition:
| Vectors a, b | a·b | ǀaǀ | ǀbǀ | θ | Relationship |
|---|---|---|---|---|---|
| (1, 2, 3), (4, −5, 6) | 12 | 3.7417 | 8.7750 | 68.56° | neither |
| (1, 0), (0, 1) | 0 | 1 | 1 | 90° | orthogonal |
| (2, 3), (4, 6) | 26 | 3.6056 | 7.2111 | 0° | parallel (b = 2a) |
| (1, 2, 3), (−1, −2, −3) | −14 | 3.7417 | 3.7417 | 180° | parallel, opposite (b = −a) |
| (3, 4), (−4, 3) | 0 | 5 | 5 | 90° | orthogonal |
| (0, 0, 0), (1, 2, 3) | 0 | 0 | 3.7417 | undefined | zero vector |
The table highlights the three landmarks worth memorizing. Orthogonal vectors (perpendicular) always have dot product 0 — no matter how long they are, the (1,0)·(0,1) and (3,4)·(−4,3) rows both give 0. Parallel vectors give the product of the magnitudes, positive if same direction (26) and negative if opposite (−14). And the zero vector has no direction, so the angle is undefined even though the dot product is 0 — a degenerate case every robust calculator must flag[wikipedia-euclidean-vector].
- Positive, zero, or negative is the fastest read. Positive dot product → vectors point in the same general direction. Zero → perpendicular. Negative → more opposite than aligned. You can interpret a dot product correctly without computing any angle[khan-dot-product].
- Work in physics is a dot product. W = F·d = |F||d|cos θ — the force component along the displacement does the work. Push at 90° to the motion (θ = 90°)? The dot product is 0, and no work is done, no matter how hard you push. That is why carrying a heavy box horizontally feels "easy" compared to lifting it[wikipedia-dot-product].
- Projection is built from the dot product. The length of a vector a projected onto b is (a·b)/|b| — the scalar projection. Graphics engines, navigation, and machine learning all use this to decompose vectors into components along and across a reference direction[wikipedia-scalar-projection].
- Orthogonality is the special case to spot first. If your dot product is 0 (within rounding), the vectors are perpendicular — a fact that often simplifies the rest of a problem dramatically.
- 2D and 3D behave identically. The formulas are the same; adding the z-components just extends the sum. If your data lives in 2D, there is no penalty to using the 3D mode with z = 0 for both vectors.
- Check your signs. A single sign error in a component flips that term's contribution and can change the dot product completely. The (1,2,3)·(4,−5,6) example shows why: the middle term −10 nearly cancels the other two.
- Normalize to focus on direction. The dot product mixes length and alignment. If you care only about direction, divide by the magnitudes: cos θ = (a·b)/(|a||b|) isolates pure alignment on a scale from −1 (opposite) to +1 (same). This normalized form is what the calculator uses internally for the angle, and it is the standard tool for comparing directions across vectors of very different lengths.
- It is a scalar, not a vector. The dot product gives one number — it cannot tell you the direction of anything. If you need a vector perpendicular to two inputs (for rotations, torques, normals), that is the cross product's job, not the dot product's[mathworld-dot-product].
- The angle is undefined for a zero vector. The formula divides by |a||b|; if either magnitude is 0, the ratio is 0/0. A zero vector has no direction, so no angle exists. The calculator flags this rather than returning a misleading 0°.
- It loses magnitude information on its own. A dot product of 12 could come from two short aligned vectors or two long perpendicular-ish ones. The dot product alone does not tell you how long the vectors are — you need the magnitudes, which the calculator also reports.
- Exact orthogonality is fragile in floating point. Real-world components rarely give exactly 0. The calculator uses a tolerance (|a·b| < 10⁻¹⁰ · |a||b|) to recognize near-orthogonality without being fooled by rounding noise.
- Same dimension is required. The dot product of a 2D and a 3D vector is undefined — you cannot add a product of 2 terms to a product of 3. Both vectors must have the same number of components[lamar-dot-product].
- Numerical overflow on huge components. Squaring very large components can overflow. The two-pass approach (compute dot first, then divide) is stable for realistic inputs, but astronomically large vectors can still lose precision.
- ❓ What is the difference between the dot product and the cross product?
- ✅ The dot product returns a scalar (a single number) measuring how much two vectors point in the same direction; the cross product returns a vector perpendicular to both inputs, whose magnitude measures how 'different' the directions are. The dot product is zero for perpendicular vectors; the cross product is zero for parallel vectors.
- ❓ What does a dot product of zero mean?
- ✅ For nonzero vectors, a dot product of zero means the vectors are orthogonal — perpendicular to each other (θ = 90°). This is the fastest test for perpendicularity and is used constantly in geometry, physics, and computer graphics. A zero dot product involving a zero vector is degenerate: the zero vector has no direction to compare.
- ❓ Can a dot product be negative?
- ✅ Yes. The dot product is negative when the vectors point in generally opposite directions (θ between 90° and 180°). A dot product of −14 for (1,2,3)·(−1,−2,−3) means the vectors are parallel but pointing opposite ways — the angle is 180°.
- ❓ How do I find the angle between two vectors?
- ✅ Use θ = arccos((a·b)/(|a||b|)). Compute the dot product, divide by the product of the magnitudes, and take the inverse cosine. The calculator does this automatically and reports the angle in degrees; note that many programming languages return arccos in radians, so convert by multiplying by 180/π.
- ❓ What is the dot product used for in real life?
- ✅ Work in physics (W = F·d), computing angles in navigation and robotics, determining perpendicularity in geometry, projecting vectors for graphics and machine learning, and measuring alignment everywhere from crosswinds to lighting. It is the standard tool for the question 'how much do these two things point the same way?'
- ❓ Why is the dot product called a scalar product?
- ✅ Because its result is a scalar — a single real number — rather than a vector. 'Scalar product' emphasizes this, distinguishing it from the vector (cross) product. The name 'dot product' comes from the dot notation a·b used to write it.
- ❓ Does the dot product work for vectors in higher dimensions?
- ✅ Yes. The component formula generalizes to any dimension: a·b = Σ aᵢbᵢ for i = 1 to n. The calculator offers 2D and 3D because those are the everyday cases, but the formula itself is dimension-agnostic and is used in n-dimensional machine learning and data science.
- ❓ What is the dot product of a vector with itself?
- ✅ It equals the squared magnitude: a·a = |a|². This is why |a| = √(a·a), and why the dot product is positive-definite — a·a is always positive unless a is the zero vector. It is the cleanest way to compute a vector's length.
References
- [1]Wolfram MathWorld. (n.d.). Dot Product.
- [2]Wikipedia. (2026). Dot Product.
- [3]Wikipedia. (2026). Scalar Projection.
- [4]Wikipedia. (2026). Euclidean Vector.
- [5]Khan Academy. (n.d.). Vector Dot Product and Vector Length.
- [6]MIT OpenCourseWare. (2011). 18.06SC Linear Algebra — Gilbert Strang.
- [7]LibreTexts (OpenStax Calculus III). (n.d.). The Dot Product.
- [8]Paul's Online Math Notes. (n.d.). Dot Product — Calculus II.
Last updated: August 17, 2026
UnByte — Independent Software Engineering
Every calculator references authoritative sources — Editorial policy
