Vector Calculator (Dot Product, Cross Product, Magnitude, Unit Vector, Angle)

Enter two 2D or 3D vectors to instantly calculate the dot product, cross product, magnitude (norm), unit vectors, and the angle between the two vectors — a free vector calculator.

What this vector calculator does

Enter the components of two vectors and this tool returns the dot product, the cross product, the magnitude of each vector, their unit vectors and the angle between them, all at once. You can switch between two and three dimensions; in two dimensions the cross product field stays empty, because the cross product is only defined in three dimensions. The quantity ax·by − ay·bx that is sometimes called the "2D cross product" is a scalar — it is just the z component of the three-dimensional cross product, not a vector.

Everything here comes down to arithmetic on the components plus a square root and an inverse cosine. The dot product is a·b = axbx + ayby + azbz, the magnitude is √(x² + y² + z²), a unit vector is each component divided by the magnitude, and the angle follows from cos θ = a·b ÷ (|a||b|). A zero vector has no direction, so neither a unit vector nor an angle can be formed from one; the tool reports that as an error rather than returning a misleading number.

How to use the vector calculator

  1. Choose the number of dimensions Decide between 2D and 3D first. Picking 3D adds a z component field and enables the cross product.
  2. Enter the components of a and b Fill in x and y (and z in three dimensions). Negative values and decimals are handled as they are.
  3. Read the results The dot product, cross product, magnitudes, unit vectors and angle all appear together. In 2D the cross product field explains that the operation needs three dimensions.
  4. Check the directions on the diagram In two dimensions the vectors are drawn for you, which makes relationships of direction and angle far easier to judge than from numbers alone.

Tips for getting more out of it

  • Switch between 2D and 3D with the tabs above. Choosing 3D reveals the z-component input fields and the cross product result.
  • When the dot product is 0, the two vectors are orthogonal (perpendicular). A positive value means an acute angle between them; a negative value means an obtuse angle.
  • The resulting cross product vector points in a direction perpendicular to both input vectors, following the right-hand rule.
  • A unit vector is the original vector divided by its magnitude (norm) — it has a length of exactly 1 and represents direction only. Use it whenever you only care about direction, not magnitude.
  • Entering a zero vector (every component equal to 0) makes the magnitude 0, so the unit vector and the angle cannot be calculated for it.

When vector arithmetic comes up

Checking homework and exam practice

A single dropped sign or misplaced division changes the answer for a dot product or an angle. Comparing against a machine catches that in seconds.

Coordinate work in 3D graphics and game code

Surface normals come from the cross product, and the relationship between a view direction and a surface comes from the dot product. Trying the numbers here first is quicker than debugging the shader.

Resolving forces and computing work in physics

Work is the dot product of force and displacement, and torque is the cross product of a position vector and a force. Unit vectors are what you want when only the direction matters.

Measuring how closely two directions agree

The dot product of two unit vectors is exactly cos θ. The cosine similarity used throughout machine learning is this same calculation under a different name.

Vector terms explained

Dot product
The sum of the products of matching components. The result is a scalar, and because a·b = |a||b|cos θ, a value of zero means the two vectors are perpendicular.
Cross product
An operation defined only in three dimensions whose result is a vector perpendicular to both inputs. Its magnitude equals the area of the parallelogram the two vectors span, and its direction follows the right-hand rule.
Magnitude (norm)
The length of a vector, given by √(x² + y² + z²). It is Pythagoras' theorem carried into three dimensions.
Unit vector
A vector scaled to length 1, used when you want to keep the direction and discard the size. You get one by dividing each component by the magnitude.
Angle between vectors
The angle separating two vectors, always between 0° and 180°. It comes from dividing the dot product by the product of the magnitudes and taking the inverse cosine.
Zero vector
The vector whose components are all zero. It has length zero and no direction, so neither a unit vector nor an angle can be defined for it.

Frequently Asked Questions

The dot product takes two vectors and produces a single number (a scalar), commonly used to measure similarity or find the angle between vectors. The cross product takes two vectors and produces a new vector perpendicular to both — and it is only defined in three dimensions.

A three-dimensional space is the only one where a direction perpendicular to two given vectors can be uniquely determined. In 2D there is no consistent perpendicular direction to pick, and in 4D and higher there are infinitely many, so the general cross product is naturally defined only in 3D.

Using the formula cosθ = (a·b) / (|a||b|). Dividing the dot product by the product of the two magnitudes gives cosθ, and taking its inverse cosine (arccos) yields the angle θ, in either degrees or radians.

A unit vector points in the same direction as the original vector but has a magnitude (length) of exactly 1. It is found by dividing a vector by its magnitude, and it is commonly used for surface normal vectors in computer graphics or whenever only direction, not magnitude, matters.

Calculate the dot product — if it equals 0, the two vectors are orthogonal (perpendicular). This tool calculates the dot product of your input vectors automatically, so you only need to check whether that value is 0.
Tool-kun

Side Note — Vectors were born out of Hamilton's quaternions

The vector notation we use today traces back to "quaternions," a system invented by the 19th-century Irish mathematician William Rowan Hamilton to represent rotations in three dimensions. A quaternion consists of four numbers, and it was the three components of its "imaginary part" that eventually became the prototype for the modern vector.

It was the American physicist Josiah Willard Gibbs and the British engineer Oliver Heaviside who separated vectors from quaternions and organized them into the dot product and cross product we use today. Working independently in the late 19th century, they stripped away the parts of quaternion algebra that weren't needed for physics — especially electromagnetism — and built the vector analysis framework still taught today.

The cross product is generally defined only for 3D vectors because a three-dimensional space is uniquely suited to picking out a single direction perpendicular to two given vectors. Thanks to this property, the cross product shows up throughout physics — in torque and angular momentum — as well as in computer graphics, where it is used to compute the normal vector of a surface.