Vector Calculator (2D & 3D)

Calculate dot and cross products, magnitude, unit vectors, addition, subtraction, and the angle between two vectors with clear steps.

Dot Product Cross Product Magnitude 2D · 3D · Full Steps
Share this tool

Vector Setup

Dimensions

Complete analysis

One calculation returns sums, differences, products, lengths, unit vectors, and the angle.

Vector A

Vector B

Quick Load:

Calculating vectors...

Ready to analyze two vectors

Enter two vectors to calculate every common vector operation at once.

What Is a Vector Calculator?

A vector calculator evaluates operations on quantities that have both magnitude and direction. Enter two 2D vectors as (x, y) coordinates or two 3D vectors as (x, y, z) coordinates, and the calculator returns their sum, differences, dot product, cross product, lengths, unit vectors, and included angle. Every result includes the substituted formula, so the page works as both a quick answer and a check on handwritten linear algebra.

Vectors model displacement, velocity, force, surface normals, and directions in space. Their components describe movement along coordinate axes. Some vector operations return another vector, while others return a scalar number. Addition and subtraction produce vectors; magnitude and the dot product produce scalars. A 3D cross product produces a vector perpendicular to both inputs.

How Vector Operations Connect

How to Calculate a Dot Product

Multiply matching components, then add the products. In two dimensions, A · B = AxBx + AyBy; in three dimensions, add AzBz. For example, (1, 2, 3) · (4, 5, 6) = 4 + 10 + 18 = 32. The dot product is commutative, so A · B equals B · A.

The sign describes directional alignment. A positive dot product means the vectors generally point in similar directions, while a negative result means they generally oppose each other. Two nonzero vectors are perpendicular when their dot product is zero. The dot product also supplies the cosine formula used to calculate the angle between vectors.

How to Calculate a Cross Product in 2D and 3D

For 3D vectors, A × B = (AyBz − AzBy, AzBx − AxBz, AxBy − AyBx). This output is perpendicular to both A and B, and its direction follows the right-hand rule. Reversing the order reverses the result: B × A = −(A × B), so the cross product is not commutative.

Two ordinary 2D vectors do not have a cross-product vector that stays in their plane. Instead, embed them in the xy-plane with z equal to zero. The only nonzero possible component is AxBy − AyBx, so this calculator reports that scalar z-component. Its absolute value is the area of the parallelogram spanned by the vectors, while its sign indicates orientation.

Vector Magnitude and Unit Vector Formula

Magnitude is Euclidean length: |v| = √(x² + y²) in 2D and |v| = √(x² + y² + z²) in 3D. A (3, 4) vector has magnitude 5. Magnitude is always nonnegative and equals zero only for the zero vector.

A unit vector keeps the original direction but has length 1. Divide every component by the magnitude: v̂ = v / |v|. Normalizing (3, 4) gives (0.6, 0.8). The zero vector cannot be normalized because division by its zero magnitude is undefined.

How to Find the Angle Between Two Vectors

Use θ = acos((A · B) / (|A||B|)). The principal angle is between 0° and 180°: matching directions give 0°, perpendicular directions give 90°, and opposite directions give 180°. Both vectors must be nonzero because a zero vector has no direction. The calculator reports degrees and radians and limits tiny floating-point drift before applying inverse cosine.

Vector Formula Reference Table

Operation2D formula3D formulaOutput
Addition(Ax+Bx, Ay+By)(Ax+Bx, Ay+By, Az+Bz)Vector
Dot productAxBx + AyByAxBx + AyBy + AzBzScalar
Cross productAxBy − AyBx(AyBz−AzBy, AzBx−AxBz, AxBy−AyBx)Scalar z / vector
Magnitude√(x²+y²)√(x²+y²+z²)Scalar
Unit vectorv / |v|v / |v|Vector
Angleacos((A·B)/(|A||B|))Same formulaScalar angle

Vector Calculator FAQ

How do you calculate the dot product of two vectors?

Multiply corresponding vector components and add the products. For 3D vectors, A dot B equals AxBx plus AyBy plus AzBz. The answer is a scalar and equals zero when a nonzero pair is perpendicular.

How do you calculate the cross product in 3D?

Expand A × B into (AyBz − AzBy, AzBx − AxBz, AxBy − AyBx). The resulting vector is perpendicular to both inputs, with direction determined by the right-hand rule.

Can you take the cross product of two 2D vectors?

Yes. Embed both vectors in the xy-plane and report AxBy minus AyBx, the scalar z-component of their 3D cross product. This signed value also acts as the two-dimensional determinant.

How do you find the magnitude of a vector?

Square each component, add the squares, and take the square root. In 3D, the magnitude is the square root of x squared plus y squared plus z squared. Magnitude cannot be negative.

What is a unit vector and how do you calculate it?

A unit vector has magnitude 1 and preserves a nonzero vector's direction. Divide each component by the original magnitude; the zero vector has no unit-vector form.

How do you find the angle between two vectors?

Divide the dot product by the product of the two magnitudes, then apply inverse cosine. This produces the principal angle from 0° to 180° when both vectors are nonzero.

What happens when one vector is the zero vector?

Addition, subtraction, dot product, cross product, and magnitude remain defined. A zero vector has no direction, so its unit vector and angle with another vector are undefined. This calculator preserves the valid results and labels only the direction-dependent outputs as undefined.