Maths

Vector Calculator

Find the dot product, cross product, angle, magnitudes, sum and difference of two 3D vectors.

By Nitin Raturi · Last reviewed

Your worksheet

How to use the Vector Calculator

Work out the dot and cross products and the angle between two vectors.

  1. Enter the x, y and z parts of vector a.
  2. Enter the parts of vector b.
  3. Read the angle, then the products, sum and difference.

Good to know

  • A dot product of 0 means the vectors are perpendicular.

a · b = |a||b| cos θ; a × b is at right angles to both. Use z = 0 for 2D.

a x component

The x part of vector a.

How to fill it in

  • Enter any number, negative allowed. Use 0 for z in two dimensions.

Example

a = (1, 2, 3) has length 3.7417.

a y component

The y part of vector a.

How to fill it in

  • Enter any number, negative allowed. Use 0 for z in two dimensions.

a z component

The z part of vector a.

How to fill it in

  • Enter any number, negative allowed. Use 0 for z in two dimensions.

b x component

The x part of vector b.

How to fill it in

  • Enter any number, negative allowed. Use 0 for z in two dimensions.

Example

(1, 2, 3) × (4, 5, 6) = (−3, 6, −3); the vectors are 12.93° apart.

b y component

The y part of vector b.

How to fill it in

  • Enter any number, negative allowed. Use 0 for z in two dimensions.

Example

(3, 0, 0) and (0, 4, 0) are 90.00° apart: their dot product is 0.

b z component

The z part of vector b.

How to fill it in

  • Enter any number, negative allowed. Use 0 for z in two dimensions.

Example

(3, 4, 0) and (6, 8, 0) point the same way (0.00°); (2, −1, 4) and (−3, 5, 2) are 96.10° apart.

Angle between the vectors

12.9332°

a = (1, 2, 3) and b = (4, 5, 6): a · b = 32 and a × b = (−3, 6, −3), so they are 12.9332° apart.

|a|
3.7417
|b|
8.775
a + b
(5, 7, 9)
a − b
(−3, −3, −3)
a · b
32
a × b
(−3, 6, −3)
|a × b| (parallelogram area)
7.3485
Projection of a on b
3.6467

Vectors in three dimensions; set the z parts to 0 for 2D. The cross product follows the right-hand rule.

How this calculator works

  1. Step 1Dotaₓbₓ + a_y b_y + a_z b_zA number: |a||b| cos θ.
  2. Step 2Crossa × bA vector at right angles to both.
  3. Step 3Angleatan2(|a × b|, a · b)Accurate at any angle.

The dot product of two vectors is a single number. It is largest when they point the same way, zero when they are perpendicular and negative when they point apart.

The cross product is a vector at right angles to both, with a length equal to the area of the parallelogram they span.

Worked example: (1, 2, 3) and (4, 5, 6)

Dot product, cross product and angle
cos θ
a · b ÷ (|a| |b|)
  1. a · b1 × 4 + 2 × 5 + 3 × 632
  2. |a|√(1 + 4 + 9)3.7417
  3. a × b(2 × 6 − 3 × 5, 3 × 4 − 1 × 6, 1 × 5 − 2 × 4)(−3, 6, −3)
  4. Angle12.93°

Read the result

  • Perpendicular90.00°(3, 0, 0) and (0, 4, 0): dot product 0.
  • Parallel0.00°(3, 4, 0) and (6, 8, 0): cross product zero.

A negative dot product means more than 90° apart: (2, −1, 4) and (−3, 5, 2) are 96.10° apart.

The parallelogram spanned by (1, 2, 3) and (4, 5, 6) has area 7.3485.

Assumptions and limits

  • 3DUse z = 0 for flat vectors.
  • Right-hand ruleFor the cross product direction.
  • Zero vectorHas no angle or direction.
  • DegreesAngles from 0° to 180°.

Vectors and matrices are the language of directions and transformations.

For matrix products, inverses and determinants, use the matrix calculator. The distance calculator finds lengths between points, and the slope calculator handles lines in two dimensions.

Common mistakes

  • Mistake: Expecting a × b = b × a.

    Instead: Swapping reverses the cross product.

  • Mistake: Treating the dot product as a vector.

    Instead: It is a single number.

Checking the method

A separate script finds every angle with the law of cosines and each cross product by cofactor expansion, and matches each golden value.

Read how we test our calculators, or browse more maths calculators.

Frequently asked questions

What is (1, 2, 3) × (4, 5, 6)?

(−3, 6, −3), at right angles to both vectors.

What is the angle between (1, 2, 3) and (4, 5, 6)?

12.93°, from a · b = 32 and the magnitudes.

How do I know if two vectors are perpendicular?

Their dot product is 0, as for (3, 0, 0) and (0, 4, 0) at 90.00°.

What does a zero cross product mean?

The vectors are parallel, like (3, 4, 0) and (6, 8, 0) at 0.00°.

What does a negative dot product mean?

The angle is over 90°: (2, −1, 4) and (−3, 5, 2) are 96.10° apart.

Sources and methodology

The formulas are standard time-value-of-money results. We check every figure against golden values worked out independently, by closed form and by month-by-month simulation; see the methodology.

Written and maintained by Nitin Raturi, a software engineer (about the author). Last reviewed 4 Nov 2026; next review due by . Found an error? Tell us.

Changelog

  • : Initial release.