Logo

MonoCalc

/

Angle Between Vectors Calculator

Geometry

Vector Mode

Output Unit

Vector A

X

Y

Vector B

X

Y

Decimal Precision

Angle Between Vectors

10.3048°

Acute (10.3°)

0.1799 rad

AB

Cosine of Angle

0.9839

Dot Product (A · B)

11

Magnitude of A

5

Magnitude of B

2.2361

About This Tool

Angle Between Vectors Calculator – Degrees, Radians, and Cosine Similarity

The angle between two vectors tells you how far apart two directions are in space — a core computation in linear algebra, physics, computer graphics, and machine learning. This calculator finds the angle between vector A and vector B in 2D or 3D space, and reports the result simultaneously in degrees and radians, along with the underlying dot product, magnitudes, cosine value, and a plain-language relationship label.

The Angle Formula

The angle θ between two vectors is derived from the dot product identity A·B = |A|·|B|·cos θ. Rearranging for θ gives the formula this calculator uses:

cos(θ) = (A · B) / (|A| × |B|)
θ = arccos(cos(θ))

Where the dot product and magnitudes are computed as:

  • Dot product (2D): A·B = Ax·Bx + Ay·By, or in 3D: A·B = Ax·Bx + Ay·By + Az·Bz
  • Magnitude: |A| = √(Ax² + Ay² [+ Az²])

For example, A = (3, 4) and B = (1, 2) give A·B = 11, |A| = 5, and |B| ≈ 2.236, so cos(θ) ≈ 0.9839 and θ ≈ 10.30°.

Cosine Similarity

The value cos(θ) itself is often called cosine similarity — it ranges from 1 (vectors point in exactly the same direction) through 0 (perpendicular) down to -1 (vectors point in exactly opposite directions). Cosine similarity is widely used in natural language processing and machine learning to compare document embeddings, feature vectors, and recommendation profiles without being affected by vector magnitude — only direction matters.

Interpreting the Relationship Label

Beyond the raw angle, this calculator classifies the pair of vectors into one of five relationships:

  • Parallel (0°): the vectors point in exactly the same direction.
  • Acute (0°–90°): the vectors point in broadly similar directions.
  • Perpendicular (90°): the dot product is zero — the vectors are orthogonal.
  • Obtuse (90°–180°): the vectors point in broadly opposing directions.
  • Opposite / anti-parallel (180°): the vectors point in exactly opposite directions.

Why the Cosine Value Is Clamped

Floating-point arithmetic can occasionally push cos(θ) a tiny fraction outside the valid range of [-1, 1] — for example 1.0000000002 — which would make arccos return NaN. This calculator clamps the cosine value to [-1, 1] before applying arccos, guaranteeing a valid angle every time.

Handling the Zero Vector

If either vector A or vector B has zero magnitude (all components equal zero), the angle is mathematically undefined — there is no direction to measure an angle from. The calculator detects this case (magnitude below 1e-15) and shows a clear error instead of a misleading result.

Real-World Applications

  • Physics: Finding the angle between two force vectors, or between a velocity vector and a surface normal.
  • 3D graphics and game development: Comparing a camera's facing direction to a target, or a character's heading to a waypoint.
  • Machine learning and NLP: Measuring cosine similarity between text embeddings or user/item feature vectors in recommendation systems.
  • Chemistry: Estimating bond angles from atomic position vectors in molecular geometry.
  • Robotics and navigation: Checking alignment between a sensor's heading vector and a target direction.

Using This Calculator

Switch between 2D and 3D mode, enter the components of vector A and vector B, and choose whether the primary result is displayed in degrees or radians — both units are always shown. In 2D mode, a diagram plots both vectors from the origin with an arc marking the angle between them. Expand the Step-by-Step Calculation panel to see the full formula substitution, adjust decimal precision from 0 to 10 places, and use the copy or share buttons to save your results or send a pre-filled link.

Frequently Asked Questions

Is the Angle Between Vectors Calculator free?

Yes, Angle Between Vectors Calculator is totally free :)

Can I use the Angle Between Vectors Calculator offline?

Yes, you can install the webapp as PWA.

Is it safe to use Angle Between Vectors Calculator?

Yes, any data related to Angle Between Vectors Calculator only stored in your browser (if storage required). You can simply clear browser cache to clear all the stored data. We do not store any data on server.

How do you find the angle between two vectors?

The angle θ between two vectors A and B is found with the formula θ = arccos((A·B) / (|A|·|B|)), where A·B is the dot product and |A|, |B| are the vector magnitudes. This calculator computes all three quantities automatically and returns the angle in both degrees and radians.

How does this calculator work?

Enter the X, Y (and Z, in 3D mode) components of vector A and vector B, choose 2D or 3D mode, and the tool instantly computes the dot product, both magnitudes, the cosine of the angle, and the angle itself — along with a labeled relationship (parallel, perpendicular, acute, obtuse, or opposite) and a step-by-step breakdown.

What is cosine similarity and how is it related to this calculator?

Cosine similarity is simply cos(θ), the cosine of the angle between two vectors, computed as the dot product divided by the product of the magnitudes. It ranges from -1 (opposite direction) to 1 (same direction) and is widely used in machine learning and NLP to measure how similar two vectors (e.g., documents or embeddings) are.

What does it mean if the angle is 90 degrees?

A 90° angle means the two vectors are perpendicular (orthogonal), which occurs precisely when their dot product equals zero. The calculator automatically flags this case with a "Perpendicular" relationship badge.

Can the angle between two vectors be undefined?

Yes. If either vector is a zero vector (all components equal zero), the angle is mathematically undefined because the formula requires dividing by the vector's magnitude. The calculator detects this and shows an error instead of an incorrect result.

How accurate are the results, and why is the cosine value clamped?

Calculations use IEEE 754 double-precision floating-point arithmetic (about 15-16 significant digits). The cosine value is clamped to the range [-1, 1] before taking arccos, since tiny floating-point rounding errors can otherwise push it slightly outside that range and produce a NaN result.