Choose an operation, dimension, and inputs
Start by selecting one of the seven modes: Magnitude & Unit Vector, Add / Subtract, Scalar Multiply, Dot Product, Cross Product, Angle Between, or Projection. Then choose 2D ⟨x, y⟩ or 3D ⟨x, y, z⟩.
Enter the components for Vector A. Vector B appears only for operations that need a second vector. Scalar k appears only for Scalar Multiply. Components accept plain numbers or simple fractions such as -3, 2.5, and 3/4. For Add / Subtract, also choose A + B or A − B.
Calculate and manage the result
Click Calculate to validate the fields. A successful calculation reveals the result, formulas, and steps for the selected mode. The result stays hidden when validation fails.
- Copy result copies the plain-text report. If clipboard access fails, the tool shows Copy failed.
- Download result (.txt) downloads the report as the plain-text file
vector-result.txt. - Reset clears the vector and scalar fields, hides errors, and hides the result. It does not restore the example values.
What each operation returns
- Magnitude & Unit Vector returns the magnitude, a decimal unit-vector approximation, and direction cosines with axis angles. It rejects a zero Vector A because a unit vector cannot be defined from it.
- Add / Subtract performs component-wise addition or subtraction using the selected A + B or A − B control.
- Scalar Multiply multiplies Vector A by Scalar k and reports the resulting magnitude.
- Dot Product returns the exact scalar product and an angle when both vectors are nonzero. A zero dot product is identified as orthogonal only when both vectors are nonzero.
- Cross Product returns a 3D vector in 3D. In 2D it returns the signed scalar z-component; its absolute value is the parallelogram area and its sign indicates orientation. In 3D, the cross-product magnitude is shown only when both inputs are nonzero.
- Angle Between returns degrees and radians and rejects either zero vector.
- Projection returns the vector projection, scalar projection, and perpendicular component. It rejects a zero Vector B.
2D and 3D scope
One dimension control applies to every vector field, so Vector A and Vector B always use matching dimensions. The tool supports 2D and 3D vectors only. It does not support dimensions beyond 3D, symbolic algebra, or physics simulation involving forces, velocity, time, or motion.
Exact values, decimals, and validation
Parsed fractions and supported component-wise arithmetic, scalar multiples, dot products, and cross products remain exact. Magnitude, unit-vector values, direction-cosine values, and angles are displayed as decimals; the unit vector is not shown as an exact unit-vector expression.
To fix a rejected calculation, fill every component, use a valid number or fraction, and avoid a zero denominator. A zero vector is not accepted where a direction is required: unit-vector mode rejects zero Vector A, Angle Between rejects either zero vector, and Projection rejects zero Vector B.
Privacy and local processing
The vector calculator script parses and calculates values in the browser and contains no submission of entered vector values. The page also imports external analytics and CDN resources, so this does not mean that the page makes no external requests.
How to use the Vector Calculator
- Select an operation.
- Select 2D ⟨x, y⟩ or 3D ⟨x, y, z⟩.
- Enter Vector A and, when shown, Vector B or Scalar k.
- For Add / Subtract, select A + B or A − B.
- Click Calculate.
- After a successful result, use Copy result or Download result (.txt).
Frequently Asked Questions
What vector operations does this calculator support?
It supports Magnitude & Unit Vector, Add / Subtract, Scalar Multiply, Dot Product, Cross Product, Angle Between, and Projection for 2D or 3D vectors.
Does it support both 2D and 3D vectors?
Yes. Select 2D ⟨x, y⟩ or 3D ⟨x, y, z⟩. The same selection controls every vector field, so A and B always have matching dimensions.
How does cross product work in 2D?
In 2D, Cross Product returns the signed scalar z-component of the equivalent 3D cross product, ax*by − ay*bx. Its absolute value equals the parallelogram area, and its sign indicates orientation; it is not a vector result.
What happens with a zero vector?
A zero vector has no direction. Magnitude & Unit Vector rejects a zero Vector A, Angle Between rejects either zero vector, and Projection rejects a zero Vector B. Dot Product still returns zero, and Cross Product still returns the zero result. Dot-mode orthogonality is reported only for nonzero vectors.
Are results exact or rounded?
Parsed fractions and supported component-wise arithmetic, scalar multiples, dot products, and cross products remain exact. Magnitudes, unit-vector values, direction-cosine values, and angles are displayed as decimals, and the unit vector is shown as a decimal approximation.