Math calculator

Vector Calculator

Magnitude, unit, sum, both products and the projection.

Magnitude, unit, and every product

Leave the second blank for one vector alone.

u = (3, 4), v = (4, 3)

|u| = 5

They are 16.2602° apart, from the dot product divided by both magnitudes.

|u|

5

Pythagoras on the components

Unit vector of u

(0.6, 0.8)

length exactly 1

|v|

5

the second magnitude

u · v

24

the dot product

u + v

(7, 7)

componentwise

u − v

(-1, 1)

componentwise

The two products, and what they mean

The dot and cross products with their values and geometric meanings
QuantityValueWhat it measures
Dot product24how much they agree in direction; zero means perpendicular
cross (scalar)-7the signed area of the parallelogram they span
Projection of u on v(3.84, 2.88)u’s shadow on v, of length 4.8
Angle16.2602°the unsigned angle between them
  • The magnitude is Pythagoras in as many dimensions as there are: √(3² + 4²) = 5.000000000.
  • The unit vector keeps the direction and throws away the length. Its components are the cosines of the angles to each axis, which is why they are called direction cosines and why they always square-sum to 1.
  • The dot product is 24.00000000. Zero means perpendicular, whatever the lengths — no square roots and no trigonometry, which is why it is the test everything uses.
  • In the plane the cross product has nowhere perpendicular to point, so it is reported as a signed scalar — the area of the parallelogram, positive when v is anticlockwise from u.
  • The projection of u onto v is 4.8000000 — the length of u's shadow on v. Multiplied by v's unit vector it gives the shadow itself, which is the component of u in that direction.

Parallelism is decided on the cross product, so exactly parallel vectors return exactly 0° rather than a millionth of a degree.

What this tool shows

A dot product of zero means perpendicular, whatever the lengths — no square roots and no trigonometry, which is why it is the test everything uses. The cross product measures the opposite: it is zero exactly when the vectors are parallel.

  • Magnitude and unit vector
  • Sum and difference
  • The dot product, and what zero means
  • The cross product in space and in the plane
  • The projection of one vector onto another
  • Direction angles from each axis
Every common operation Exact perpendicular test 2D and 3D Direction angles

Exact products; decimal magnitudes.

Updated 7 September 2026 · Works in any browser, no installation

The magnitude is Pythagoras on the components; the unit vector is that divided out. For (3,4): magnitude 5, unit vector (0.6, 0.8). With a second vector, the dot product tests perpendicularity — zero means a right angle — and the cross product tests parallelism, being zero exactly when they line up.

At a glance

Formula shown
|u| = \u221a(\u03a3u\u1d62\u00b2). The unit vector is u/|u|. u \u00b7 v = \u03a3u\u1d62v\u1d62, zero exactly when perpendicular. In space u \u00d7 v is a vector perpendicular to both whose length is the parallelogram area; in the plane it reduces to the scalar u\u2081v\u2082 \u2212 u\u2082v\u2081.
Scenario support
Normalising a direction; testing whether two directions are perpendicular; finding the component of a force along a line; computing a surface normal.
Educational estimate
Planning support from the values you enter — not professional advice.

Magnitude and unit vector

Magnitude is the length: the square root of the sum of the squared components. It is Pythagoras, extended to as many dimensions as the vector has.

The unit vector is the same direction with length exactly 1 — divide every component by the magnitude. It answers “which way” with the “how far” removed.

Normalising is one of the most common operations in graphics and physics, because directions compose and lengths get in the way. A lighting calculation wants the direction to the light, not the distance.

The zero vector has no unit vector. Dividing by a magnitude of zero has no answer, and the direction genuinely does not exist — this page reports that rather than returning zeros.

The two products

Two vectors have two useful products, and they measure opposite things.

The dot product gives a number: multiply matching components and add. It measures agreement in direction, scaled by both lengths. It is |u||v|cosθ, so it is zero exactly when the angle is 90°.

The cross product gives a vector in three dimensions: one perpendicular to both inputs, with length |u||v|sinθ. That length is the area of the parallelogram the two vectors span, so it is zero exactly when they are parallel and the parallelogram is flat.

In two dimensions there is nowhere perpendicular for a cross product to point, so what is reported is the scalar u₁v₂ − u₂v₁ — the signed area, positive when v is anticlockwise from u.

Between them they give the whole geometry: the dot gives cosθ, the cross gives sinθ, and their ratio gives the tangent.

Projection

The projection of u onto v is u’s shadow on v — how much of u points along v.

Its length is (u · v)/|v|, and the shadow itself is that length times v’s unit vector. What is left over, u minus the projection, is perpendicular to v — which is what makes projection a decomposition rather than just a number.

That decomposition is used constantly. Splitting a force into a component along a slope and one into it; finding the shortest distance from a point to a line; resolving a velocity into along-track and cross-track parts.

It is also the basis of least-squares fitting, where the best fit is the projection of the data onto the space of possible models.

Why parallelism is not tested with an angle

The obvious test for parallel is “the angle is 0° or 180°”. It does not work in floating point, and the reason is worth knowing.

Take (2,4) and (1,2), which are exactly parallel. Their cosine computes as 0.9999999999999998 rather than 1 — one bit off. But arccos has an unbounded derivative near 1, so that one bit becomes about a millionth of a degree, and the page would report 0.0000012° for vectors that are exactly aligned.

The cross product does not have that problem. For (2,4) and (1,2) it is 2×2 − 4×1 = 0, exactly, in integers. So parallelism is decided there and the angle is then reported as exactly 0° or 180°.

Perpendicularity is tested the same way, on the dot product, for the same reason.

Direction angles

In three dimensions, “the direction of a vector” is three angles: one from each axis.

Their cosines are exactly the components of the unit vector, which is why they are called direction cosines. And because the unit vector has length 1, those three cosines always square-sum to 1 — a useful check on any set of them.

In two dimensions one angle is enough, and it is usually given from the positive x-axis. That is the bearing or argument of the vector, and computing it from the components needs atan2 rather than atan, so the quadrant survives.

Where it gets used

Physics. Force, velocity and acceleration are vectors. Work is a dot product, and torque is a cross product — which is why a force applied along a spanner does nothing and a force across it turns the nut.

Graphics. Surface normals from cross products, lighting from dot products, directions from unit vectors. Every frame of every 3D scene.

Navigation. Headings and velocities add as vectors, which is how a crosswind correction is computed.

Machine learning. Cosine similarity between embedding vectors is the normalised dot product, and it is how two documents or two search results are compared at scale.

Sources and methodology

The operations are standard linear algebra; these are the references.

Method. The dot and cross products are computed as sums of products and stay exact for whole-number inputs, which matters because they are what the perpendicularity and parallelism tests rest on — an approximately-zero product would be a wrong answer rather than a rounded one. Magnitudes and angles involve square roots and inverse cosines and are decimal, and the page says which is which. Parallelism is decided on the cross product rather than on the angle, because acos is ill-conditioned near ±1. That engine is verified on every change against 67 hand-written assertions, including that |u|² equals u·u, that every unit vector has magnitude exactly 1, and that the cross product is perpendicular to both inputs — the last checked as an exact integer zero across four thousand generated pairs. The count and the per-case breakdown are published on the formula verification page.

Related calculators

Where this goes next:

Angle Between Two VectorsDot product, magnitudes and the angle as separate steps, in the plane or in space — with exactly parallel vectors returning 0° rather than a floating-point smudge.
DistanceThe distance between two points in the plane or in space, kept exact as a surd wherever the square root does not come out — √50 stays √50, and is also shown as 5√2.
Line EquationThe equation of a line in all three standard forms from two points or from a point and a slope, with the intercepts and the vertical case that has no y = mx + c form at all.
Trigonometric FunctionsAll six functions at once with exact surd values at the sixteen special angles — and tan 90° reported as undefined rather than as the 1.6 × 10¹⁶ a double returns.
Pythagorean Theorema² + b² = c² solved for whichever side you leave blank, with the triangle drawn to scale and integer triples reduced to their primitive.
QuaternionExact quaternion arithmetic showing both pq and qp every time, both quotients rather than one, and the rotation a unit quaternion represents with axis, angle, matrix and the gimbal-lock case named.

More in Math, or browse all calculators.

Read the guide

For the angle alone with the dot-product working laid out step by step, the Angle Between Two Vectors Calculator is the focused version of that part.

Educational use disclaimer

This is an educational tool. Dot and cross products are exact for whole-number inputs; magnitudes and angles involve square roots and inverse cosines and are decimal.

How we calculate · Found an error? email us

Authorship & verification

Written and maintained by , a business operator who builds spreadsheet-based calculators.

What's changed (3 updates)

Published 7 September 2026

  1. Published the vector page covering magnitude, unit vector, sum, difference, both products and the projection, in two dimensions or three.
  2. Parallelism is decided on the cross product rather than on an inverse cosine: acos is ill-conditioned near ±1, and the angle route reports about a millionth of a degree for vectors that are exactly aligned.
  3. Says what each product measures — a dot product of zero is a right angle whatever the lengths, and a cross product of zero is parallelism — so the two are chosen on purpose rather than by memory.

Add this calculator to your site

Responsive embed — and private: nothing your visitors type leaves their browser.