Skip to content
Test versionSearch

Mathematics

Three-dimensional vectors

Calculate the dot product, cross product, lengths and angle between two three-dimensional vectors from their x, y and z components. The angle is shown in degrees.

How it worksFAQRelated tools

Content reviewed:

Enter the x, y and z components of vectors a and b. If a vector has zero length, the angle is undefined and shown as a dash. You can change every value; the format of decimal results is under More options. Downloads keep your inputs and results, and nothing is saved or sent.

The dot product a · b = ax·bx + ay·by + az·bz is zero for perpendicular vectors. The cross product a × b is perpendicular to both vectors. The angle comes from cos θ = a · b / (|a| |b|) and is shown in degrees.

Decimal results are approximate. Inputs stay in this browser tab.

How it works

Formula and units are shown with the result. Floating-point arithmetic except exact integer combinatorics/modulo and cent-based bill distribution. Unit vector calculator: enter the X, Y and Z components of one nonzero vector in the separate form. For two dimensions enter Z as 0. Each unit-vector component is divided by the unrounded original vector length. The displayed length and components are floating-point approximations. Each entered component must be zero or have absolute value from 0.000000001 to 1000000. Current JSON, HTML, TXT and scenario CSV/TXT retain the entered values and raw results.

Worked example

With these example values the calculator gives the result below. You can change any value in the form above.

Inputs

Vector a: x
1
Vector a: y
0
Vector a: z
0
Vector b: x
0
Vector b: y
1
Vector b: z
0

Result

Dot product
0
Cross product x
0
Cross product y
0
Cross product z
1
Length a
1
Length b
1
Angle
90 °

Frequently asked questions

How do I calculate the dot product of two 3D vectors?

Enter the x, y and z components of vectors a and b. The three-dimensional vector calculator adds the products of matching components, a·b = Σ aⱼbⱼ, and also returns the cross product, both lengths and the angle.

How is the angle between two vectors calculated?

The angle follows cos θ = (a·b) ÷ (|a| × |b|) and is shown in degrees. For a = (1, 0, 0) and b = (0, 1, 0) the dot product is 0 and the angle 90 degrees.

What is the cross product of (1, 0, 0) and (0, 1, 0)?

The cross product of these two vectors is (0, 0, 1). Both vectors have length 1.

How do I find a unit vector?

In the separate unit vector form, enter the X, Y and Z components of one nonzero vector. Each component is divided by the unrounded original length; for a two-dimensional vector enter Z as 0.

What happens with a zero vector?

The angle with a zero vector is undefined and is shown as a dash. The unit vector form needs at least one nonzero component.

Which value ranges does the vector calculator accept?

Unit vector components may be zero or have an absolute value from 0.000000001 to 1000000. In the additional workflows each component may be up to 1 million in absolute value.