2D Vector Calculator
Add, subtract, and compute dot product, cross product magnitude, unit vector, and angle between two 2D vectors.
Shows component-by-component working.
A vector has both magnitude (size) and direction, where a scalar has only magnitude. This calculator works in two dimensions, so a vector here is written (x, y).
Basic operations
Addition: (a, b) + (c, d) = (a+c, b+d). So (3, 2) + (1, 4) = (4, 6).
Subtraction: (a, b) − (c, d) = (a−c, b−d). Subtraction is the one that trips people up, because A − B is the vector that takes you from the tip of B to the tip of A. If A and B are two positions, A − B is the displacement between them.
Magnitude (length): |v| = √(x² + y²)
Example: |(3, 4)| = √(9 + 16) = √25 = 5. It is Pythagoras with the components as the two legs.
Unit vector: v̂ = v / |v|
Divide a vector by its own length and you get a vector of length 1 pointing the same way. (3, 4) / 5 = (0.6, 0.8). Unit vectors are how you separate “which way” from “how much”, which is why graphics and physics code is full of them. The zero vector has no unit vector, since you cannot divide by zero.
Dot product: A · B = AxBx + AyBy
Example: (2, 3) · (4, 1) = 8 + 3 = 11. The dot product is also |A||B|cos θ, which rearranges to θ = arccos(A·B / (|A||B|)). The sign alone tells you a lot before you compute any angle: positive means the vectors point broadly the same way, zero means they are perpendicular, negative means they oppose.
The 2D cross product
The full cross product is a 3D operation producing a vector perpendicular to both inputs. In the plane there is nowhere perpendicular to go, so what survives is a single signed number, the z-component of the 3D result:
A × B = AxBy − AyBx
This is often called the cross product magnitude, which is misleading, because it is signed. Two facts make it worth having:
- Its absolute value is the area of the parallelogram spanned by A and B. Half of that is the area of the triangle through the origin and the two tips, which is how a computer works out the area of a polygon.
- Its sign is the turn direction. Positive means B lies counter-clockwise from A, negative means clockwise, zero means the two are parallel (or one is the zero vector). Every “is this point left or right of that line” test in graphics and geometry is this one subtraction.
Worked example: the angle between two vectors
v1 = (1, 0), v2 = (1, 1). The dot product is 1, |v1| = 1, |v2| = √2, so cos θ = 1/√2 and θ = 45°. Cross product = 1(1) − 0(1) = 1, positive, so v2 sits counter-clockwise from v1. Both answers agree with the picture.
Where vectors show up
Physics uses them for force, velocity, acceleration and fields. Computer graphics runs on surface normals, lighting and camera orientation. Navigation adds a wind vector to an aircraft’s air velocity to get its track over the ground, which is exactly the parallelogram in the chart below. And in machine learning the cosine of the angle between two vectors, straight from the dot product, is the standard measure of how similar two documents or word embeddings are.
How we build and check this calculator
This calculator runs entirely in your browser, so the numbers you enter stay on your device. The math behind it is written by hand and tested against worked examples and standard references before the page goes live.
SuperGlobalCalculator is independently built and maintained. See how we build and verify our calculators.