CalculateItNow home

Vector Calculator

Dot product, cross product, magnitudes, the angle between two 3D vectors and the projection of one onto the other, with every step written out.

Vector Calculator: with the default inputs, dot product a · b is 11.

Try an example
Dot product a · b
11
Magnitude |a|
5
Magnitude |b|
3
Angle between them (degrees)
42.8334
Cross product a × b
(8, -6, 2)
Magnitude |a × b|
10.198039
Scalar projection of a onto b
3.666667
Relationship
Acute angle (42.83°) — they broadly agree in direction
Assumptions
  • Vectors are given in Cartesian components in a right-handed coordinate system.
  • The angle is returned in degrees, between 0° and 180°.
  • Perpendicular and parallel are tested with a relative tolerance of 1e-12, not exact equality, because floating-point components rarely cancel exactly.
Component by component
Componentaba × b (elementwise)a × b (cross)
x3138
y428-6
z0202

The elementwise products add to the dot product, 11 — a single number. The cross column is a vector, perpendicular to both a and b.

Math verified by automated testsUpdated 2026-09-092 sources cited

How this is worked out

The formula

a · b = aₓbₓ + a_y b_y + a_z b_z            (a scalar)
|a| = √(aₓ² + a_y² + a_z²)

a × b = (a_y b_z − a_z b_y,  a_z b_x − a_x b_z,  a_x b_y − a_y b_x)   (a vector)
|a × b| = |a||b| sin θ

θ = arccos( a · b ÷ (|a| |b|) )
Scalar projection of a onto b = a · b ÷ |b|

Open How it’s calculated above to see this worked through with your own numbers.

What you enter

a — x
A number.defaults to 3
a — y
A number.defaults to 4
a — z
Leave both z values at 0 for 2D vectors.defaults to 0
b — x
A number.defaults to 1
b — y
A number.defaults to 2
b — z
A number.defaults to 2

What you get back

Dot product a · bmain answer
Magnitude |a|
Magnitude |b|
Angle between them (degrees)
Undefined if either vector is zero.
Cross product a × b
Magnitude |a × b|
Also the area of the parallelogram the two vectors span.
Scalar projection of a onto b
Relationship

What this assumes

  • Vectors are given in Cartesian components in a right-handed coordinate system.
  • The angle is returned in degrees, between 0° and 180°.
  • Perpendicular and parallel are tested with a relative tolerance of 1e-12, not exact equality, because floating-point components rarely cancel exactly.

About this calculator

Vectors carry both a size and a direction, and there are two completely different ways to multiply them. The dot product returns a number and measures how much two vectors point the same way. The cross product returns a new vector, perpendicular to both, whose length measures how much they don't. This calculator computes both, plus the magnitudes, the angle and the projection.

How to use it

Type the x, y and z components of each vector. For 2D work leave both z values at 0 — everything still applies, and the cross product collapses to a single z-component whose sign tells you whether b is counter-clockwise from a.

Reading the dot product

a · b = |a||b| cos θ, so its sign alone answers a useful question:

  • Positive — the vectors point broadly the same way (angle under 90°).
  • Zero — they are perpendicular. This is the standard test for orthogonality, and it is exact.
  • Negative — they point broadly opposite ways (angle over 90°).

In physics the dot product is work: force dotted with displacement. Only the component of the force along the motion counts, which is exactly what the cosine picks out.

Reading the cross product

a × b is perpendicular to both inputs, with direction given by the right-hand rule, and its magnitude equals the area of the parallelogram the two vectors span. Two consequences follow immediately: parallel vectors have a zero cross product (no area), and the cross product is anti-commutative — b × a is the exact negative of a × b. It is torque, angular momentum and surface normals in disguise.

The steps include a cross-check you can use by hand: |a||b| sin θ must equal |a × b|, using the θ that came out of the dot product.

Where it goes wrong

  • The angle needs both vectors to be non-zero. The zero vector has no direction, so there is no angle to report — the calculator says so rather than returning a spurious 0° or 90°. The dot and cross products are still perfectly well defined; both are zero.
  • The cross product is 3D only. There is no cross product of two vectors in the plane in the same sense; the z-component you get by padding with zeros is the useful 2D analogue.
  • Order matters for the cross product and not for the dot product. Swapping the inputs flips the cross product's sign.
  • Floating-point arithmetic means a dot product will rarely be exactly zero for computed vectors, so the perpendicular test here uses a relative tolerance rather than an exact comparison.

Frequently asked questions

What does the dot product tell you?

How much two vectors point in the same direction. It equals |a||b|cos θ, so it is positive for acute angles, zero for perpendicular vectors and negative for obtuse ones.

How do I find the angle between two vectors?

Take the dot product, divide by the product of the magnitudes, and apply arccos. The result is between 0° and 180°, and is undefined if either vector is zero.

What is the cross product used for?

It produces a vector perpendicular to both inputs, which makes it the natural tool for surface normals, torque and angular momentum. Its magnitude is the area of the parallelogram the two vectors span.

How do I know if two vectors are perpendicular?

Their dot product is zero. That is both the definition and the practical test — no angles or square roots required.

Why is a × b different from b × a?

The cross product is anti-commutative: b × a = −(a × b). Same length, opposite direction, because the right-hand rule flips when you swap the operands.

Put this calculator on your own site

A working vectors, free for any site, with no ads and no sign-up. It resizes to fit wherever you paste it and updates itself as this page improves.

Paste this anywhere. It works on any site, carries no ads, never expires, and always shows the current version.

Vector Calculator by CalculateItNow

The page's own title. The clearest description of what the link leads to.

The credit line sits outside the widget on purpose, so it is a real link on your page rather than one buried in a frame. Please keep it — it is what pays for CalculateItNow staying free and ad-free. The script only resizes the widget to fit its contents; drop it and the widget still works.

Browse every calculator widget·How to add it to WordPress, Squarespace or Wix

The questions people ask next to a vectors.

All math calculators·Browse everything