Angle Between Two Vectors Calculator
Find the angle between two vectors in 2D or 3D. Returns degrees and radians, cos θ, the dot product, both magnitudes, and a perpendicular/parallel verdict.
Angle Between Two Vectors Calculator
Background.
The Quanta angle between two vectors calculator takes the components of two non-zero vectors in the plane or in space and returns the angle between them in degrees and radians, together with the cosine that produced it, the dot product, both magnitudes, and a plain-language verdict on whether the pair is perpendicular, parallel, antiparallel, acute or obtuse. With the default vectors a = (2, 2, 1) and b = (1, 2, 2), the calculator returns a dot product of 8, magnitudes of 3 and 3, a cosine of 8/9, and an angle of 27.2660444507° — an acute angle, so the two vectors point broadly the same way.
The whole method rests on a single identity: the dot product of two vectors equals the product of their lengths times the cosine of the angle between them. OpenStax Calculus Volume 3 states it as Theorem 2.4, a·b = ‖a‖‖b‖cos θ, and rearranging gives cos θ = (a·b)/(‖a‖‖b‖). Because the dot product can be computed straight from components without knowing any angle, and the magnitudes likewise, this turns a geometric question into three sums of products and one inverse cosine. That is why the dot product is introduced in every linear algebra and mechanics course before the angle formula: the angle is the payoff, not the definition.
The result is an unsigned angle. arccos returns a value between 0° and 180°, which is the smaller of the two angles the vectors subtend, measured in the plane they span. It carries no sense of rotation — there is no clockwise or counter-clockwise here, no negative angles, and no reflex angles above 180°. If you need a signed, directed angle in the plane, that is a different computation built on atan2 rather than on the dot product, and it depends on which way round you take the two vectors. This page states the convention rather than leaving you to discover it from a surprising answer.
The special cases are the ones people usually come for. A dot product of exactly zero means cos θ = 0 and θ = 90°: the vectors are orthogonal, which is Theorem 2.5 of the same OpenStax section, and it is the fastest perpendicularity test there is. A cosine of exactly +1 means the vectors are parallel and point the same way, so θ = 0°. A cosine of exactly −1 means they are antiparallel, θ = 180°. Because floating-point arithmetic almost never lands on an exact 0 or ±1 when the inputs are decimals, this calculator uses a declared tolerance of 1e-12 on the cosine when it decides which label to print, and it classifies the unrounded value so the label can never contradict the angle displayed beside it.
Two inputs are refused: either vector being zero. The zero vector has no direction, the formula divides by a magnitude of zero, and there is no angle to report — so you get a field error rather than a plausible-looking 90°. Everything else works, including vectors whose components differ by many orders of magnitude, and the calculator forms the cosine as one square root over the product of the squared magnitudes so that genuinely parallel integer inputs land on exactly ±1.
What is angle between two vectors calculator?
The angle between two vectors is the smaller of the two angles they subtend where their tails meet, measured in the plane the two vectors span, and reported on the range 0° to 180°. It is defined through the dot product: OpenStax Calculus Volume 3, §2.3, Theorem 2.4 gives u·v = ‖u‖‖v‖cos θ, so cos θ = (u·v)/(‖u‖‖v‖) and θ = arccos of that quantity. OpenStax University Physics Volume 1 states the same relation in component form as Equation 2.34, cos φ = (AxBx + AyBy + AzBz)/(AB), and Wolfram MathWorld gives X·Y = |X||Y|cos θ as Equation 1 of its 'Dot Product' entry. Because the dot product is symmetric — a·b = b·a — the angle is symmetric too: it does not matter which vector you enter first. The quantity cos θ is bounded in [−1, 1] by the Cauchy–Schwarz inequality, which is what guarantees arccos is always defined for genuine vectors. Three values of the cosine have names: +1 means the vectors are parallel and θ = 0°; 0 means they are orthogonal and θ = 90°, the condition Theorem 2.5 of the same section states as u·v = 0; and −1 means they are antiparallel and θ = 180°. The angle is unsigned and carries no orientation, so it is never negative and never exceeds a straight angle; a signed planar angle requires atan2 instead. It is undefined when either vector is zero, because a zero vector has no direction.
How to use this calculator.
- Choose 2D or 3D. In 2D the z fields are ignored and treated as exactly 0.
- Enter the components of vector a and vector b. Neither may be the zero vector, but the order does not matter — the angle is symmetric.
- Read the angle θ in degrees at the top, and in radians directly beneath if that is what your work needs.
- Read the relationship line for the plain-language verdict: perpendicular, parallel, antiparallel, acute or obtuse.
- Check cos θ if you want the raw similarity value rather than an angle; it is the same number a cosine similarity calculator would return.
- Use the dot product and the two magnitudes to reproduce the calculation by hand: divide the dot product by the product of the magnitudes, then take the inverse cosine.
The formula.
Three quantities go into the answer. The dot product a·b = axbx + ayby + azbz is the sum of the componentwise products. The magnitudes ‖a‖ and ‖b‖ are the Pythagorean lengths √(ax² + ay² + az²) and √(bx² + by² + bz²). Dividing the first by the product of the other two gives cos θ, by Theorem 2.4 of OpenStax Calculus Volume 3; the inverse cosine of that gives θ.
For the worked example a = (2, 2, 1) and b = (1, 2, 2): the dot product is (2)(1) + (2)(2) + (1)(2) = 2 + 4 + 2 = 8. Both magnitudes come out to √(4 + 4 + 1) = √9 = 3 and √(1 + 4 + 4) = √9 = 3, so cos θ = 8/(3 × 3) = 8/9, and θ = arccos(8/9) = 0.4758822497 radians = 27.2660444507°.
Why the division works: the dot product already contains the answer, but it is scaled by both lengths. Dividing them out leaves a pure directional quantity bounded in [−1, 1] — the Cauchy–Schwarz inequality is precisely the statement that |a·b| ≤ ‖a‖‖b‖, which is what makes arccos always defined. The same normalised quantity is what a cosine similarity calculator reports, so the two pages compute one number and present it in two registers, one geometric and one comparative.
Range and sign: arccos returns a value in [0°, 180°], and that is the standard convention for the unsigned angle between vectors. A negative dot product means an obtuse angle; a zero dot product means exactly 90°, which is Theorem 2.5, the orthogonality condition. The angle never comes out negative and never exceeds 180° because arccos cannot produce such values, so if you were expecting a directed angle of, say, 300°, this is not the tool — that requires atan2 and a choice of orientation.
Numerical care, because it changes answers at the edges. The cosine is formed as (a·b)/√(‖a‖²‖b‖²) rather than as (a·b)/(√‖a‖² × √‖b‖²): multiplying the squared magnitudes before taking a single square root removes a rounding site, which is what lets genuinely parallel integer inputs such as (1, 2, 2) and (2, 4, 4) produce a cosine of exactly 1 rather than 0.9999999999999999. The value is then clamped into [−1, 1] before the inverse cosine, because an overshoot of one part in 10¹⁶ would otherwise make arccos undefined.
Rounding stage and classification: all arithmetic runs in Decimal at 40 significant digits and is rounded once, at the return boundary, to 10 decimal places. The relationship label is decided on the unrounded cosine with a declared tolerance of 1e-12 — so a pair whose cosine is within 1e-12 of 0 is reported as perpendicular, within 1e-12 of 1 as parallel, and within 1e-12 of −1 as antiparallel. That tolerance is a floating-point allowance, not a mathematical claim, and it is stated here because a reader is entitled to know why a vector pair that is 0.0000000001° off square is still called perpendicular.
A worked example.
A robotic arm's gripper is oriented along a = (2, 2, 1) and the axis of the bolt it must engage runs along b = (1, 2, 2); the controller needs the misalignment angle before it commits to the move. The dot product is a·b = (2)(1) + (2)(2) + (1)(2) = 2 + 4 + 2 = 8. Both vectors happen to have the same length: ‖a‖ = √(4 + 4 + 1) = √9 = 3 and ‖b‖ = √(1 + 4 + 4) = √9 = 3. Dividing gives cos θ = 8 ⁄ (3 × 3) = 8/9 ≈ 0.8888888889, and the inverse cosine of that is θ = 0.4758822497 radians, or 27.2660444507 degrees. The relationship line reads 'acute angle — the vectors point broadly the same way', which is what a positive dot product always means. Because the misalignment is well under 90°, the gripper is on the correct side of the bolt and needs a rotation of roughly 27.27° to line up rather than a full reversal. Had the dot product come out as exactly 0 the two axes would have been perpendicular, and a negative value would have meant the gripper was pointing back along the bolt rather than at it.
Frequently asked questions.
How do I find the angle between two vectors by hand?
Can the angle between two vectors be negative or more than 180°?
How do I tell if two vectors are perpendicular?
What does a negative dot product mean?
Why is my answer slightly off from 0° or 90°?
Is the cosine shown here the same thing as cosine similarity?
What if one of my vectors is the zero vector?
References& sources.
- [1]OpenStax, Calculus Volume 3 (2016 ed., web revision retrieved 2026-07-29), §2.3 ‘The Dot Product’ — Theorem 2.4 (u·v = ‖u‖‖v‖cos θ, hence cos θ = u·v/(‖u‖‖v‖)) and Theorem 2.5 (non-zero vectors are orthogonal if and only if u·v = 0). Open access.
- [2]OpenStax, University Physics Volume 1 (2016 ed.), §2.4 ‘Products of Vectors’ — Equation 2.27 (A·B = AB cos φ), Equation 2.33 (component form), Equation 2.34 (cos φ from components), and Example 2.16 ‘Angle between Two Forces’, which publishes F₁·F₂ = −162.4 N², cos φ = −0.439 and φ = 116.0°. This calculator reproduces every one of those figures.
- [3]Wolfram Research, MathWorld — ‘Dot Product’ (live revision retrieved 2026-07-29), Equation 1 (X·Y = |X||Y|cos θ) and Equations 8–10 (component form Σxᵢyᵢ).
- [4]Paul Dawkins, Paul's Online Notes (Lamar University), Calculus II — ‘Dot Product’, Example 2: the angle between ⟨3, −4, −1⟩ and ⟨0, 5, 2⟩ is 143.24°. Used as the independent cross-check for this page; the calculator returns 143.2441525165°, agreeing to every published digit.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 977 calculators remain free
- No billing is enabled