How to use the dot product calculator
The calculator has two levels. Simple mode is the quickest way to multiply and add the coordinates of two vectors. Advanced mode adds longer vectors and the option to work from an angle.
Simple mode: 2D and 3D vectors
- Choose 2D or 3D under Dimensions.
- Enter Vector A x, Vector A y, Vector B x, and Vector B y.
- In 3D, also enter Vector A z and Vector B z.
- Read the Dot product and the Calculation steps.
The calculator starts in 2D with A = (3, 4) and B = (4, 0), which gives 12. The z fields default to 0. The Examples menu has two ready-made cases: 2D example (the one above) and 3D right angle, with A = (1, 0, 1) and B = (1, 0, −1), which gives 0. Reset returns to the default Simple 2D inputs.
Advanced mode: Components
Choose Advanced, then keep Input method on Components. Paste each vector into Vector A components and Vector B components as a list of numbers separated by commas or whitespace.
- Both lists must have the same length, from 2 to 10 numbers.
- If your Simple inputs were valid, the first switch to Advanced copies them into the lists.
- Type an explicit
0for any coordinate that is zero. Do not leave a gap. - This method also reports Magnitude of A, Magnitude of B, Angle between vectors, and Perpendicular? (Yes, No, or Undefined).
Angle unit controls whether the angle is shown in degrees or radians.
Advanced mode: Known angle
Choose Known angle under Input method when you know the lengths of the two vectors and the angle between them, but not their coordinates. Enter Magnitude of A, Magnitude of B, and Angle between vectors. The defaults are 3, 4, and 60°, giving 6.
Enter the smaller included angle, from 0° to 180° (or 0 to π radians), inclusive. Switching Angle unit between Degrees and Radians converts the number shown in the angle field without changing the calculation. If you then edit the angle, your new value is read in the unit that is currently selected.
In Radians you can type pi/2 or π/2 for an exact right angle, and pi or π for an exact half turn. A decimal such as 1.5708 represents a slightly different angle from π/2, so it gives a small nonzero result when both magnitudes are positive.
Input limits
| Item | Accepted |
|---|---|
| Components | Zero, or a signed decimal or scientific-notation number with absolute value from 10⁻¹² to 10¹² |
| Magnitudes | Zero, or a positive number in that same range |
| Angle | 0 to 180° (0 to π rad); a positive angle must be at least 10⁻³⁰⁰ rad or its degree equivalent |
| Length | Up to 32 characters per number, 340 per component list, 46 for the angle |
Entries are treated as unitless. If your vectors carry units, such as newtons and metres, attach them to the result yourself.
The dot product formula
The dot product of two vectors has two equivalent forms, and the calculator supports both.
Component form
For vectors and in the same orthonormal coordinate system:
To find the dot product of two vectors, multiply matching components, then add the products. In 2D it is , and in 3D it adds . Each product is positive for two nonzero entries of the same sign, negative for opposite signs, and zero if either entry is zero.
Magnitude and angle form
Here is the angle between the vectors, and the magnitudes are:
The two forms are the same quantity seen two ways. The component form needs coordinates. The angle form needs lengths and an angle. If you work in degrees, the conversion is .
For two nonzero vectors you can rearrange the angle form to get the angle:
The calculator computes the angle with an equivalent, numerically stable method based on atan2, which avoids rounding trouble when vectors are nearly parallel or nearly opposite.
Worked examples
Example 1: a 2D dot product with an angle
Take A = (3, 4) and B = (4, 0).
The magnitudes are and . So:
In Advanced Components mode the calculator shows this angle in the unit you pick.
Example 2: a 3D right angle
Take A = (1, 0, 1) and B = (1, 0, −1).
Both vectors are nonzero and the dot product is exactly 0, so they are perpendicular. This is the 3D right angle example in the menu.
Example 3: from magnitudes and an angle
With , , and , choose Known angle:
The result is negative because 120° is an obtuse angle. At exactly 0°, 60°, 90°, 120°, and 180°, the calculator uses the exact cosine values 1, 1/2, 0, −1/2, and −1.
Example 4: why a decimal near π/2 is not zero
Keep the magnitudes at 5 and 2 and switch to Radians. Typing pi/2 gives exactly 0. Typing the decimal 1.5708 instead gives:
That is because 1.5708 is a little larger than . If you mean a right angle, type pi/2.
Example 5: a longer vector and the contribution chart
Take A = (2, −1, 3, 0, 4) and B = (1, 5, −2, 7, 0.5). The products are:
| Position | |||
|---|---|---|---|
| 1 | 2 | 1 | 2 |
| 2 | −1 | 5 | −5 |
| 3 | 3 | −2 | −6 |
| 4 | 0 | 7 | 0 |
| 5 | 4 | 0.5 | 2 |
The magnitudes are and , so the angle is about 98.25°. It is slightly obtuse, which matches the negative result. With 3 to 10 coordinates, the calculator draws this as a signed contribution chart: negative products to the left, positive products to the right, and zero products on the baseline. That makes it easy to see which positions pull the total up or down.
What the result means
The dot product is a single number, not a vector. For two nonzero vectors, its sign tells you about the angle between them:
| Dot product | Angle | Meaning |
|---|---|---|
| Positive | Acute, or 0° | The vectors point in broadly the same direction |
| Zero (exactly) | 90° | The vectors are perpendicular |
| Negative | Obtuse, or 180° | The vectors point in broadly opposite directions |
The size of the result depends on both lengths, so a large value does not by itself mean the vectors are well aligned. To compare direction alone, look at the angle, or at , which is .
A few useful properties:
- The order does not matter: .
- A vector dotted with itself gives its squared length: .
- Doubling one vector doubles the dot product.
Zero vectors
If either vector is all zeros, the dot product is 0, because every product is 0. A zero vector has no direction, so the angle is undefined. In Advanced Components, Perpendicular? shows Undefined. The calculator shows an advisory in that case. You need two nonzero vectors to calculate an angle.
Rounding
The dot product and magnitudes display up to 10 significant digits, and angles up to 8. For components, the calculator adds the products using exact decimal arithmetic before converting to a number, and the perpendicularity check uses that exact sum. If a result is rounded, the worked expression uses ≈. An angle that rounds to 90° for vectors that are not perpendicular is also shown with ≈.
Where the dot product is used
- Geometry: testing for right angles and finding the angle between two directions.
- Physics: work done by a constant force over a displacement is . For example, a force of (10, 5) and a displacement of (4, 0) give . Add the correct units (newtons and metres give joules) yourself.
- Computer graphics: lighting calculations compare a surface direction with a light direction.
- Data and machine learning: similarity scores between feature vectors build on dot products.
Scalar product vs. other operations
"Scalar product" is another name for the dot product, and this tool works as a scalar product calculator for real vectors. Do not confuse it with:
- Cross product: produces a vector (in 3D), not a number.
- Matrix multiplication: combines rows and columns of compatible matrices to produce a matrix.
- Complex vectors and generalized inner products: these need conjugation or a weighting that this calculator does not apply.
This calculator covers the real Euclidean dot product in matching orthonormal coordinates only. Matrix multiplication, matrix–vector multiplication, generalized inner products, and complex vectors are not supported.
Common mistakes and error messages
- Lists of different lengths. Both component lists must have the same number of entries. A mismatch shows a field-specific message and an em dash (—) in place of the result.
- Missing zeros. Write
3, 0, 4, not3, , 4. - Angle outside the range. Use the smaller included angle, from 0° to 180°.
- Degrees vs. radians. If your answer is wrong in Known angle mode, check the Angle unit first.
- Entries out of range. A nonzero component or magnitude must have an absolute value between 10⁻¹² and 10¹².
Help, Copy, and Export
Help summarizes the input methods, angle syntax, visuals, and utilities. Copy gives you the current scalar result and calculation steps, plus the magnitudes, angle, and perpendicular check when Advanced Components shows them. Export opens your browser's print dialog.
The visual helps check your input. In 2D it draws vectors from a common origin, using dots for zero vectors or vectors that are too short to draw clearly as arrows. In Known angle mode the illustration places A along the positive x-axis and turns B by the entered angle.
Frequently asked questions
How do I calculate the dot product of two vectors?
Multiply each pair of matching components and add the products. For A = (3, 4) and B = (4, 0), the dot product is .
Can I find the dot product from an angle?
Yes. Choose Advanced, then Known angle, and enter both magnitudes and the angle. The calculator uses . With 3, 4, and 60°, the result is 6.
What does a dot product of zero mean?
For two nonzero vectors, an exact zero means they are perpendicular. If one vector is the zero vector, the result is also 0, but the angle and perpendicularity are undefined.
Can the dot product be negative?
Yes. A negative result means the angle is greater than 90°, including 180° when the vectors point in exactly opposite directions.
How many components can I enter?
Each list can have 2 to 10 numbers, and both lists must be the same length.
Is the scalar product the same as the dot product?
Yes. For real vectors in standard coordinates, scalar product and dot product mean the same thing.
Does this calculator work with complex vectors or matrices?
No. It handles real vectors only. Matrix multiplication, matrix–vector multiplication, generalized inner products, and complex vectors are outside its scope.
Why does my angle show with ≈?
The angle display uses ≈ when a nonperpendicular angle rounds to 90° or the equivalent in radians. The Calculation steps can also use ≈ for a rounded or trigonometric approximation of the dot product.
Read the formula definitions, supported input ranges, and limitations before using this estimate.