About the Vector Calculator
This vector calculator does the everyday vector operations in one place. Enter the components of vectors a and b, in two or three dimensions, and it returns the dot product, the cross product, the magnitude (length) of each vector, the angle between them, their sum and difference, unit vectors, the scalar and vector projection of a onto b, and the area of the parallelogram they span.
It is aimed at students in linear algebra, calculus, physics and engineering, and at developers working with graphics or game maths who need a quick check of a hand calculation. Each result is labelled with standard notation, and the notes tell you at a glance whether the vectors are perpendicular, parallel or pointing in opposite directions.
For 2D vectors the z-components are treated as zero, so the cross product points along the z-axis and its z-component is the familiar 2D "perp dot" product. The angle is given in degrees and radians.
With the default inputs, the dot product a · b is 32. Change any value above to recalculate instantly.
How to use the vector calculator
- 1Choose 3D or 2D vectors.
- 2Enter the x, y (and z) components of vector a.
- 3Enter the components of vector b.
- 4Read the dot product, cross product, magnitudes and angle.
- 5Use the projection and unit-vector results for further work.
Formula and method
The dot product multiplies matching components and adds them; it equals |a||b|cos θ, so it is zero for perpendicular vectors and is used to find the angle θ between them. The cross product (3D only) is a vector perpendicular to both a and b, following the right-hand rule, whose length |a||b|sin θ equals the area of the parallelogram spanned by the two vectors.
Magnitude is the Euclidean length from the Pythagorean theorem, and a unit vector is the vector divided by its magnitude. The scalar projection of a onto b is a · b ÷ |b| (the signed length of a’s shadow on b), and the vector projection is (a · b ÷ |b|²) × b. In 2D mode the z-components are set to 0.
- a, b
- Input vectors with components (x, y, z)
- |a|
- Magnitude (length) of a
- θ
- Angle between a and b (0°–180°)
- ×, ·
- Cross product and dot product
Worked examples
a = (1, 2, 3), b = (4, 5, 6)
a · b = 1×4 + 2×5 + 3×6 = 32. a × b = (2×6 − 3×5, 3×4 − 1×6, 1×5 − 2×4) = (−3, 6, −3). |a| = √14 ≈ 3.742 and |b| = √77 ≈ 8.775, so cos θ = 32 ÷ 32.833 and θ ≈ 12.93°.
Perpendicular 2D vectors (3, 4) and (−4, 3)
The dot product is 3×(−4) + 4×3 = 0, so the vectors are perpendicular (90°). Both have length 5, and the z-component of the cross product, 3×3 − 4×(−4) = 25, equals the area of the square they span.
Unit axes scaled: (2, 0, 0) and (0, 3, 0)
Vectors along the x- and y-axes are perpendicular, so the dot product is 0. The cross product points along +z with length 2 × 3 = 6, which is also the area of the 2 × 3 rectangle they form.
Frequently asked questions
What is the difference between the dot product and the cross product?+
The dot product of two vectors is a single number (a scalar) that measures how much they point in the same direction. The cross product is a new vector perpendicular to both, whose length equals the area of the parallelogram they span.
How do you find the angle between two vectors?+
Divide the dot product by the product of the magnitudes and take the inverse cosine: θ = arccos(a · b ÷ (|a||b|)). For (1, 2, 3) and (4, 5, 6) that gives about 12.93°.
How do you calculate the magnitude of a vector?+
Square each component, add the squares and take the square root: |a| = √(x² + y² + z²). The vector (3, 4) has magnitude √(9 + 16) = 5.
How can I tell if two vectors are perpendicular or parallel?+
Vectors are perpendicular (orthogonal) when their dot product is zero. They are parallel when their cross product is the zero vector, which also means one is a scalar multiple of the other.
Does the order matter in a cross product?+
Yes. The cross product is anti-commutative: b × a = −(a × b). Swapping the vectors keeps the length but flips the direction, following the right-hand rule. The dot product does not depend on order.