Audited 29 Jul 2026·Last updated 31 Jul 2026·4 citations·Tier 2·0 uses

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

Vector dimension
Vector a must not be the zero vector. The result is symmetric, so it does not matter which vector you call a.
Used only in 3D mode.
Vector b must not be the zero vector.
Used only in 3D mode.
Angle θ
27.266
The unsigned angle between the two vectors, always between 0° and 180°. It has no orientation — swapping a and b gives the same answer, and it is never negative and never reflex.
Angle θ in radians
0.4759
Relationship
acute angle — the vectors point broadly the same way
cos θ
0.8889
Dot product a·b
8
Magnitude ‖a‖
3
Magnitude ‖b‖
3

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.

  1. Choose 2D or 3D. In 2D the z fields are ignored and treated as exactly 0.
  2. 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.
  3. Read the angle θ in degrees at the top, and in radians directly beneath if that is what your work needs.
  4. Read the relationship line for the plain-language verdict: perpendicular, parallel, antiparallel, acute or obtuse.
  5. Check cos θ if you want the raw similarity value rather than an angle; it is the same number a cosine similarity calculator would return.
  6. 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.

cos θ = (a·b) ⁄ (‖a‖ ‖b‖) , θ = arccos(cos θ)

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.

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.

bx1
ax2
by2
ay2
bz2
az1
dimension3

Frequently asked questions.

How do I find the angle between two vectors by hand?
Compute three numbers and combine them. First the dot product: multiply the x components together, the y components together, the z components together, and add the results. Then each magnitude: square the components of a vector, add them, take the square root. Finally divide the dot product by the product of the two magnitudes to get cos θ, and take the inverse cosine. For a = (2, 2, 1) and b = (1, 2, 2), that is 8 divided by (3 × 3) = 8/9, and arccos(8/9) = 27.2660444507°. Set your calculator to degrees or radians deliberately — mixing the two is the single most common error in this computation.
Can the angle between two vectors be negative or more than 180°?
Not with this formula. The inverse cosine returns values only between 0° and 180°, so what you get is the unsigned angle: the smaller of the two angles the vectors subtend, with no sense of rotation attached. That is the standard convention, and it is why swapping a and b changes nothing. If you need a signed angle — for example to know whether to rotate clockwise or counter-clockwise in the plane — you need atan2(ax·by − ay·bx, ax·bx + ay·by) instead, which returns values in (−180°, 180°] and does depend on the order of the two vectors. That is a genuinely different computation, not a variant of this one.
How do I tell if two vectors are perpendicular?
Their dot product is zero. That is Theorem 2.5 in OpenStax Calculus Volume 3: two non-zero vectors are orthogonal if and only if u·v = 0. You do not need the magnitudes or the inverse cosine at all — just multiply componentwise and add, and if the total is zero the vectors are at right angles. This calculator reports the dot product explicitly for that reason, and prints 'perpendicular' in the relationship line. Because decimal inputs almost never produce an exact zero in floating-point arithmetic, the verdict uses a tolerance of 1e-12 on the cosine; integer inputs like (1, 0) and (0, 1) hit exactly zero and are reported as perpendicular without any tolerance being needed.
What does a negative dot product mean?
It means the angle between the vectors is greater than 90° — they point broadly in opposite directions. Since a·b = ‖a‖‖b‖cos θ and the magnitudes are always positive, the sign of the dot product is exactly the sign of cos θ, and cosine goes negative past a right angle. In physics this is often the useful part of the answer: a force whose dot product with the displacement is negative is doing negative work, meaning it is resisting the motion rather than driving it. If the dot product is negative and the two vectors also have the same direction ratios, the cosine will be exactly −1 and the vectors are antiparallel — the same line, opposite ways.
Why is my answer slightly off from 0° or 90°?
Almost always because the inputs are decimal approximations of values that would be exactly parallel or exactly perpendicular in exact arithmetic. A cosine computed as 0.9999999999999998 instead of 1 yields an angle of about 0.000001° instead of 0. This calculator reduces that in two ways: it carries 40 significant digits internally, and it computes the cosine as one square root over the product of the squared magnitudes rather than as a quotient of two separate square roots, which removes a rounding site. It also clamps the cosine into [−1, 1] before the inverse cosine, because a value even a hair above 1 would make arccos undefined and produce an error instead of 0°.
Is the cosine shown here the same thing as cosine similarity?
Yes — cos θ and cosine similarity are the same quantity, (a·b)/(‖a‖‖b‖). The difference is only in what is being asked. This page is aimed at a geometric question about two vectors in the plane or in space, so it reports degrees and radians as the hero answer and offers a perpendicular/parallel verdict. A cosine similarity calculator is aimed at comparing high-dimensional vectors such as text embeddings or TF-IDF rows, so it accepts arbitrarily long lists of components and reports the similarity itself, along with cosine distance. If you have two long lists rather than two or three components, use the cosine similarity page.
What if one of my vectors is the zero vector?
Then there is no angle, and this calculator raises a field error rather than returning a number. A zero vector has no direction, so 'the angle between it and something else' has no meaning; algebraically the formula divides by a magnitude of zero. Some software quietly returns 90° or 0° in this case, which is worse than an error because it looks like an answer. If you hit this in real work, the interesting question is upstream: what made the vector collapse — two coincident points, a cancelled pair of forces, an empty feature row — and how should that case be handled deliberately?

In this category

Embed

Quanta Pro

Paid features are coming later.

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