Vector Calculator
A free tool by DeepRit, a Google Ads agency that does PPC and nothing else. We build and run Google Ads accounts so every click is accounted for. Book a free audit call
Free vector calculator for 2D and 3D vectors. Find the magnitude, unit vector, sum, difference, dot product, cross product, angle and projection.
- Unit vector of A
- 0
- A · B
- 0
- A × B
- 0
- Angle between
- 0
- A + B
- 0
- A − B
- 0
- Scalar projection of A on B
- 0
Free, no sign-up. Runs in your browser: nothing you type is uploaded or saved.
How to use the vector calculator
- Enter vector A as numbers separated by commas, for example 3, 4, 0. Two components make a 2D vector; three make a 3D vector.
- Optionally enter vector B in the same way.
- Read the results as you type.
With one vector, the vector calculator shows its magnitude and unit vector. With two, it also shows the dot product, cross product, the angle between them, their sum and difference, and the scalar projection of A onto B.
What is a vector?
A vector is a quantity with both size and direction. Displacement, velocity, force and acceleration are all vectors: a force of 10 newtons pushing east is different from 10 newtons pushing north. A vector is usually written as a list of components along perpendicular axes, such as (3, 4) in two dimensions or (3, 4, 0) in three. A quantity with size only, like mass or temperature, is called a scalar.
Vectors are fundamental in physics, engineering, computer graphics, navigation, machine learning and many other fields. The vector calculator handles the most common operations so you can check homework, design calculations or code.
Magnitude and unit vectors
The magnitude, or length, of a vector is found with the Pythagorean theorem extended to any number of dimensions:
|A| = √(a₁² + a₂² + a₃²)
For A = (3, 4, 0), |A| = √(9 + 16 + 0) = 5.
A unit vector has a magnitude of 1 and points in the same direction. You get it by dividing each component by the magnitude:
 = A ÷ |A|
For A = (3, 4, 0), the unit vector is (0.6, 0.8, 0). Unit vectors are used whenever only the direction matters, such as surface normals in 3D graphics or direction of travel.
Adding and subtracting vectors
To add or subtract vectors, combine matching components:
A + B = (a₁ + b₁, a₂ + b₂, a₃ + b₃)
A − B = (a₁ − b₁, a₂ − b₂, a₃ − b₃)
With A = (3, 4, 0) and B = (1, 2, 2), A + B = (4, 6, 2) and A − B = (2, 2, −2). Geometrically, adding vectors means placing them head to tail; the sum goes from the start of the first to the end of the second.
The dot product
The dot product (or scalar product) multiplies matching components and adds the results:
A · B = a₁b₁ + a₂b₂ + a₃b₃
For A = (3, 4, 0) and B = (1, 2, 2), A · B = 3 + 8 + 0 = 11.
The dot product is also equal to |A| |B| cos θ, where θ is the angle between the vectors. That gives three useful facts:
- If the dot product is zero, the vectors are perpendicular.
- If it's positive, the angle is less than 90°.
- If it's negative, the angle is more than 90°.
The angle between two vectors
Rearranging the dot product formula gives the angle:
θ = arccos(A · B ÷ (|A| |B|))
For the default vectors, |A| = 5 and |B| = 3, so θ = arccos(11 ÷ 15) ≈ 42.83°. The vector calculator shows the angle in degrees.
The cross product
The cross product (or vector product) is defined for 3D vectors. It produces a new vector perpendicular to both:
A × B = (a₂b₃ − a₃b₂, a₃b₁ − a₁b₃, a₁b₂ − a₂b₁)
For A = (3, 4, 0) and B = (1, 2, 2), A × B = (4 × 2 − 0 × 2, 0 × 1 − 3 × 2, 3 × 2 − 4 × 1) = (8, −6, 2).
Its magnitude equals |A| |B| sin θ, which is the area of the parallelogram formed by the two vectors. Its direction follows the right-hand rule: if the fingers of your right hand curl from A towards B, your thumb points along A × B. The cross product isn't commutative: B × A = −(A × B).
For 2D vectors, the vector calculator treats them as having a z-component of 0, so the cross product points straight along the z-axis. For A = (3, 4) and B = (4, 3), it's (0, 0, −7).
Scalar projection
The scalar projection of A onto B is the length of A's "shadow" along B's direction:
comp_B A = A · B ÷ |B|
For the default vectors, it's 11 ÷ 3 ≈ 3.667. It's used to resolve a force into a component along a slope, or to find how far a point lies along a direction. To get the vector projection, multiply the scalar projection by the unit vector of B.
A worked example
Find the angle between A = (2, −1, 3) and B = (4, 0, −2), and a vector perpendicular to both.
- Magnitudes: |A| = √(4 + 1 + 9) = √14 ≈ 3.742; |B| = √(16 + 0 + 4) = √20 ≈ 4.472.
- Dot product: 8 + 0 − 6 = 2.
- Angle: arccos(2 ÷ (3.742 × 4.472)) ≈ 83.14°.
- Cross product: ((−1)(−2) − 3 × 0, 3 × 4 − 2 × (−2), 2 × 0 − (−1) × 4) = (2, 16, 4).
You can check that (2, 16, 4) is perpendicular to both: its dot product with A is 4 − 16 + 12 = 0, and with B it's 8 + 0 − 8 = 0. Enter the vectors in the vector calculator to see the same results.
Who uses a vector calculator
Physics and engineering students use it to check problems on forces, velocities and fields. Game developers and 3D artists use dot and cross products for lighting, collision and camera calculations. Engineers use vectors for structural loads and fluid flows. Data scientists use dot products and angles to measure similarity between vectors, for example cosine similarity between text embeddings.
Need more customers from Google?
This tool is free and runs in your browser. If your business also needs more leads or sales, Google Ads is where people search with their wallet out. DeepRit manages Google Ads for small and mid-size businesses, and only Google Ads. We check your account before we ever get on a call, then fix the structure, the keywords, the tracking and the ads, with month-to-month terms and no long contract. Book a free audit call.
Vectors in physics
Many physics laws are written in vector form. Work done by a force is the dot product of the force and the displacement: W = F · d. Only the component of the force along the motion does work. Torque is the cross product of the position vector and the force: τ = r × F. Magnetic force on a moving charge is F = q v × B. In each case, the vector calculator handles the arithmetic once you've set up the vectors in consistent units.
Cosine similarity
In data science, the cosine of the angle between two vectors is used to measure how similar they are, regardless of their length. It's the dot product divided by the product of the magnitudes, the same quantity the vector calculator uses to find the angle. A cosine of 1 means the vectors point the same way, 0 means they're unrelated (perpendicular), and −1 means they point in opposite directions. For the default vectors, the cosine similarity is 11 ÷ 15 ≈ 0.733.
Higher dimensions
Vectors can have any number of components. Magnitude, unit vectors, sums, differences, the dot product, the angle and the projection all work the same way in four, ten or a thousand dimensions. The cross product, though, is only defined in three dimensions, and in a special form in seven. The vector calculator works with 2D and 3D vectors; for longer vectors, apply the same formulas component by component.
Common mistakes
- Mixing up the dot and cross products. The dot product is a number; the cross product is a vector.
- Getting the cross product order wrong. A × B is the negative of B × A.
- Forgetting to normalise when only the direction matters.
- Mixing vectors of different dimensions. A and B must have the same number of components.
Vectors in computer graphics
3D graphics relies on vectors at every step. Each surface has a normal vector pointing straight out of it, often found as the cross product of two edges of a triangle and then normalised to a unit vector. The brightness of a surface under a light depends on the dot product between its normal and the direction to the light: when they point the same way, the surface is fully lit; when they're perpendicular, it gets no direct light. Cameras, reflections and collisions all use the same operations. The vector calculator is a quick way to check these calculations by hand when debugging graphics code.
Sources and further reading
- Euclidean vector on Wikipedia: definitions, operations and uses.
- Dot product on Wikipedia: algebraic and geometric definitions.
- Cross product on Wikipedia: the formula, the right-hand rule and properties.
Frequently asked questions
How do I find the magnitude of a vector?
Square each component, add them, and take the square root.
What does a dot product of zero mean?
The vectors are perpendicular (at 90° to each other).
Can I find the cross product of 2D vectors?
The vector calculator treats 2D vectors as having z = 0, so the result points along the z-axis.
How do I find the angle between two vectors?
Divide the dot product by the product of the magnitudes, then take the arccosine.
What is a unit vector?
A vector of length 1 in the same direction, found by dividing each component by the magnitude.
Is the vector calculator free?
Yes. It's free, needs no sign-up, and works in your browser.
Free PPC audit
See where your ad budget leaks.
We look at your Google Ads account before the call, then walk you through what we'd fix first, in dollars. No obligation, no hard sell.