What is a unit vector?
A unit vector is a vector with a length (magnitude) of exactly 1 that points in the same direction as the original vector. Normalizing means scaling a vector down (or up) to unit length while preserving its direction. Unit vectors are used everywhere in physics, computer graphics, robotics, and machine learning to represent pure direction without magnitude.
How to use this calculator
Enter the X and Y components of your vector. If you are working in 3D, also enter the Z component (leave it as 0 for a 2D vector). The calculator computes the magnitude and divides each component by it to return the unit vector û.
The formula explained
For a vector \(\vec{a} = (x, y, z)\), the magnitude is \(\lVert \vec{a} \rVert = \sqrt{x^{2} + y^{2} + z^{2}}\). The unit vector is $$\hat{u} = \frac{\vec{a}}{\lVert \vec{a} \rVert} = \left(\frac{x}{\lVert \vec{a} \rVert},\; \frac{y}{\lVert \vec{a} \rVert},\; \frac{z}{\lVert \vec{a} \rVert}\right)$$ meaning each component is divided by the magnitude. The result always satisfies \(\lVert \hat{u} \rVert = 1\). Note that the zero vector cannot be normalized because its magnitude is 0.
Worked example
Take \(\vec{a} = (3, 4, 0)\). The magnitude is $$\sqrt{3^{2} + 4^{2} + 0^{2}} = \sqrt{25} = 5$$ The unit vector is $$\hat{u} = \left(\frac{3}{5},\; \frac{4}{5},\; \frac{0}{5}\right) = (0.6,\; 0.8,\; 0)$$ Checking: \(\sqrt{0.6^{2} + 0.8^{2}} = \sqrt{0.36 + 0.64} = \sqrt{1} = 1\), confirming it has unit length.
FAQ
What if my vector is the zero vector? The zero vector \((0, 0, 0)\) has magnitude 0 and cannot be normalized — division by zero is undefined, so this calculator returns 0 for each component in that case.
Does this work for 2D vectors? Yes. Simply leave the Z component as 0 and the formula reduces to the 2D case.
Can a unit vector have negative components? Yes. Direction is preserved, so if the original vector points in a negative direction, the unit vector will too — only its length is normalized to 1.