
Dot Product Calculator
Use this dot product calculator and vector dot product calculator to compute the scalar product of two 3D or 2D vectors (x·u + y·v + z·w) in your browser.
Open toolEnter the Cartesian components First vector (x, y, z) and Second vector (x, y, z) into this vector angle calculator to find the interior angle theta in [0°, 180°] in degrees between any two non-zero vectors. Leave both z-coordinates at 0 for 2D planar vectors, test the preloaded (1, 0, 0) and (0, 1, 0) -> 90° orthogonal pair, or evaluate 3D coordinates up to +-1,000,000,000.
Enter the inputs, then select Calculate.
Result will appear here
Learning how to calculate angle between two vectors relies on the geometric definition of the Euclidean dot product: a . b = ||a|| * ||b|| * cos(theta). Dividing the scalar dot product xu + yv + zw by the product of the two Euclidean lengths ||a|| = sqrt(x^2 + y^2 + z^2) and ||b|| = sqrt(u^2 + v^2 + w^2) isolates cos(theta). Applying the inverse cosine (arccos) returns the unique interior angle in radians on [0, pi], which converts to degrees on [0°, 180°] by multiplying by 180° / pi.
theta = arccos((x*u + y*v + z*w) / (sqrt(x^2 + y^2 + z^2) * sqrt(u^2 + v^2 + w^2))) * (180° / pi)
In client-side JavaScript (batch11-core.js), the vectorAngle() helper first computes each vector's length via overflow-safe Math.hypot(x, y, z) and Math.hypot(u, v, w), then sums the normalized coordinate products (a_i / ||a||)*(b_i / ||b||) using Kahan compensated summation. Finally, it clamps the cosine to [-1, 1] via Math.max(-1, Math.min(1, cos)) before calling Math.acos(cos) * 180 / Math.PI, preventing NaN rounding errors when two collinear vectors yield a floating-point cosine like 1.0000000000000002.
Use this reference table to verify common 2D and 3D vector pairs, dot-product cosines, and exact degree angles before entering your own coordinates into the angle between two vectors calculator.
| Vector Pair Scenario | First Vector a = (x, y, z) | Second Vector b = (u, v, w) | Cosine cos(theta) | Angle theta (Degrees) | Geometric Relationship |
|---|---|---|---|---|---|
| Orthogonal x and y Axes (Preloaded) | (1, 0, 0) | (0, 1, 0) | 0 / (1 x 1) = 0 | 90° | Perpendicular basis axes (a perp b) |
| Parallel Co-Directional Vectors | (2, 4, 4) | (1, 2, 2) | 18 / (6 x 3) = 1 | 0° | Collinear vectors pointing in the same direction |
| Antiparallel Opposite Vectors | (3, -4, 0) | (-3, 4, 0) | -25 / (5 x 5) = -1 | 180° | Collinear vectors pointing in opposite directions |
| 2D Diagonal & Horizontal Axis | (1, 1, 0) | (1, 0, 0) | 1 / (sqrt(2) x 1) = 0.707107 | 45° | Bisector of Quadrant I in the xy-plane |
| 3D Cube Adjacent Face Diagonals | (1, 1, 0) | (1, 0, 1) | 1 / (sqrt(2) x sqrt(2)) = 0.5 | 60° | Equilateral triangle formed by face diagonals |
| 3D Cube Space Diagonal & Edge | (1, 1, 1) | (1, 0, 0) | 1 / (sqrt(3) x 1) = 0.577350 | 54.7356103172° | Magic angle (arccos(1/sqrt(3))) in crystallography |
| 2D 30-60-90 Triangle Pair | (1.73205080757, 1, 0) | (1, 0, 0) | sqrt(3) / 2 = 0.866025 | 30° | Standard 30-degree elevation above the +x axis |
| Obtuse 120-Degree Pair | (-1, 1, 0) | (1, 0, 1) | -1 / (sqrt(2) x sqrt(2)) = -0.5 | 120° | Supplementary obtuse angle (cos 120° = -0.5) |
| Tetrahedral Bond Vectors (sp3) | (1, 1, 1) | (1, -1, -1) | -1 / (sqrt(3) x sqrt(3)) = -1/3 | 109.471220634° | Methane (CH4) tetrahedral bond angle |
| Obtuse 2D Diagonal Pair | (-1, 1, 0) | (1, 0, 0) | -1 / (sqrt(2) x 1) = -0.707107 | 135° | Quadrant II diagonal relative to +x axis |
Follow these three steps to enter both vectors, handle 2D or 3D coordinates, and copy your degree result.
Type the coordinates of your initial vector a into First vector x (#x, default 1), First vector y (#y, default 0), and First vector z (#z, default 0).
Populate Second vector x (#u), Second vector y (#v, preloaded with 1), and Second vector z (#w). Leave both vertical z-axis fields at 0 whenever your vectors lie in a 2D plane.
Click Calculate result to compute the interior angle in degrees (°). Use Copy or Download to save the value for statics diagrams, 3D graphics shaders, or calculus assignments.
These three scenarios demonstrate how to calculate angle between two vectors for perpendicular axes, 3D crystal diagonals, and obtuse force vectors.
With the preloaded values a = (1, 0, 0) and b = (0, 1, 0), the dot product is 1(0) + 0(1) + 0(0) = 0 and both magnitudes equal 1. Evaluating arccos(0) * 180° / pi returns 90°, confirming that the x and y axes meet at a right angle.

Two face diagonals drawn from the same corner of a cube have coordinates a = (1, 1, 0) and b = (1, 0, 1). Their dot product is 1(1) + 1(0) + 0(1) = 1, and each vector has length sqrt(1^2 + 1^2 + 0^2) = sqrt(2). The cosine is 1 / (sqrt(2) * sqrt(2)) = 0.5, so the calculator outputs 60°.

Two tug cables pull on a mooring ring along a = (1, 2, 2) and b = (-2, 1, -2). Their magnitudes are sqrt(1+4+4) = 3 and sqrt(4+1+4) = 3, while their dot product is 1(-2) + 2(1) + 2(-2) = -4. Because cos(theta) = -4 / 9 = -0.444444, the calculator returns the obtuse angle 116.387799961°.

The output displays the non-reflex interior angle theta in degrees (°) on the closed interval [0°, 180°]. Regardless of how the two vectors are oriented in 3D space, the angle is measured in the unique plane spanned by a and b when placed tail to tail.
Sign check via dot product xu + yv + zw: A positive scalar dot product (a . b > 0) places the angle in the acute regime (0° <= theta < 90°), reaching 0° when the vectors point along the same ray. A vanishing dot product (a . b = 0) confirms an exact 90° orthogonal boundary, whereas a negative dot product (a . b < 0) places the angle in the obtuse regime (90° < theta <= 180°), reaching 180° for opposite rays.
Single-vector axis angle shortcut: If you need the direction angle of a single vector a = (x, y, z) with respect to the positive x, y, or z axis, enter (1, 0, 0), (0, 1, 0), or (0, 0, 1) as the second vector, or compute all three axis angles simultaneously in the Vector Direction Cosines Calculator.

Review these operational boundaries before using the output in engineering or graphics pipelines:
Non-zero vector requirement and unsigned interval: Both a and b must have at least one non-zero coordinate; entering (0, 0, 0) triggers the validation error 'Both vectors must be nonzero.' The arccosine formula returns the shortest unsigned angle in [0°, 180°]. If you need a signed 2D rotation direction, check the sign of the z-component (x*v - y*u) in the Cross Product Calculator.
Inspect the numerator and denominator separately in the Dot Product Calculator and Vector Magnitude Calculator, compute all three axis angles in the Vector Direction Cosines Calculator, normalize a vector in the Vector Normalizer, project one vector onto another in the Vector Projection Calculator, or convert degrees to radians in the Angle Converter.


Use this dot product calculator and vector dot product calculator to compute the scalar product of two 3D or 2D vectors (x·u + y·v + z·w) in your browser.
Open tool
Calculate the Euclidean length of any 2D or 3D vector with our free vector magnitude calculator. Enter X, Y, and Z components for instant, exact results.
Open tool
Calculate the magnitude, direction cosines, and coordinate angles (alpha, beta, gamma) of any 3D vector with our free direction cosines calculator.
Open toolChoose another tool for your next calculation, conversion, or text task.

Project any 2D or 3D vector onto another with our free vector projection calculator. Computes ((a.b)/(b.b))*b with Kahan precision, steps, and worked examples.
Open tool
Normalize any nonzero 2D or 3D vector into a unit vector of length 1 with our free vector normalizer. Enter x, y, z components for exact browser results.
Open tool
Use this free cross product calculator to find the right-handed 3D vector product a × b = (yw - zv, zu - xw, xv - yu) for physics torque and surface normals.
Open tool
Convert a quantity using the listed fixed unit factors.
Open toolAnswers about using Vector Angle Calculator and understanding its results.
Multiply matching coordinates and add them to get the dot product a . b = xu + yv + zw, then find the lengths ||a|| and ||b|| using the Pythagorean theorem. Divide the dot product by the product of those two lengths and apply the inverse cosine (theta = arccos((a . b) / (||a|| * ||b||))). For 2D vectors, keep both z inputs at 0.
Because ||a|| and ||b|| are always positive, the sign of cos(theta) matches the sign of the dot product a . b. An acute angle (0° <= theta < 90°) means a . b > 0, a 90° angle means the vectors are perpendicular (a . b = 0), and an obtuse angle (90° < theta <= 180°) means a . b < 0.
No. You can enter raw unnormalized coordinates directly into the form. Internally, the calculator computes each vector's length via Math.hypot and divides each coordinate by its vector magnitude during the cosine step, so scaling either vector by a positive constant leaves the resulting angle unchanged.
The zero vector (0, 0, 0) is a single point with magnitude ||0|| = 0 and no spatial direction. Substituting ||a|| = 0 or ||b|| = 0 into (a . b) / (||a|| * ||b||) causes division by zero (0/0), so the calculator stops and displays 'Both vectors must be nonzero.'
To convert any angle theta from degrees to radians, multiply the degree value by pi / 180 (approximately 0.01745329252). For example, 60° equals pi / 3 (about 1.0471975512 rad), and 90° equals pi / 2 (about 1.5707963268 rad). You can also paste the number into our Angle Converter.
Choose another tool for your next calculation, conversion, or text task.