UTILS.
100% in-browser
➡️

Vector Calculator

Compute dot product, cross product, magnitude, angle, unit vector and projection for two 2D or 3D vectors, live in your browser.

About this tool

Enter two vectors in 2D or 3D and get the full set of vector operations at once: dot product, cross product (in 3D), the magnitude of each vector, the angle between them, the unit vector of the first vector, the projection of one onto the other, and their sum and difference. Nothing is uploaded; the math runs in your browser.

The dot product is the sum of component-wise products, a·b = Σ aᵢbᵢ. In 3D the cross product is (a2b3 - a3b2, a3b1 - a1b3, a1b2 - a2b1). A magnitude is |a| = √(Σ aᵢ²), and the angle between the vectors is acos(a·b / (|a||b|)) converted to degrees. The unit vector is a/|a|, and the projection of a onto b is (a·b / |b|²) b.

Use it for physics, geometry or graphics work. If a vector has zero length the angle, unit vector or projection that depends on it are shown as a dash, since those quantities are undefined.

Frequently asked questions

What does the dot product mean?
It measures how much two vectors point the same way. It equals |a||b|cos(θ), so it is zero when the vectors are perpendicular.
Why is the cross product only for 3D?
The cross product returns a vector perpendicular to both inputs, which is only defined in three dimensions, so it is shown only in 3D mode.
How is the angle calculated?
From acos(a·b / (|a||b|)), given in degrees. The cosine value is clamped to the -1 to 1 range to avoid rounding errors at 0 and 180 degrees.
What is the projection of a onto b?
It is the shadow of a along the direction of b, computed as (a·b / |b|²) b, a vector pointing along b.

More tools