Unit Vector Calculator
Normalise a 2D or 3D vector: get the unit vector in i, j, k form, the magnitude divided out, and the direction cosines and angles from each axis.
Unit Vector Calculator
Background.
A well-known bug in game programming lets a character walk diagonally about 41% faster than straight ahead. Pressing right and up together gives the direction (1, 1), whose length is √2 ≈ 1.4142, and if that is used as a velocity unchanged, the extra length turns into extra speed. Dividing (1, 1) by its own length gives (0.7071, 0.7071), which points the same way but has length exactly 1. That step is called normalising, and the result is a unit vector.
A unit vector carries direction and nothing else, which is why so much of physics, engineering and graphics is written with them. A force is its size times a unit vector along its line of action. A surface in a lighting calculation is described by a unit normal, because the brightness formula treats a dot product as the cosine of an angle, and that only works when both vectors have length 1. Text-search and recommendation systems normalise their vectors so that two items are compared by direction and not by how long the vectors happen to be.
The arithmetic is short: find the length, √(x² + y² + z²), and divide every component by it. Dividing by a positive number shrinks or stretches a vector without turning it, so nothing about its direction changes. The components you end up with have a second meaning. Each is the cosine of the angle between the vector and one of the axes, so the calculator also reports those three angles. The one vector that cannot be normalised is the zero vector, which has no length to divide by and no direction to keep.
What is unit vector calculator?
A unit vector is a vector of length 1; MathWorld notes it is sometimes called a direction vector. The unit vector in the direction of a non-zero vector v is û = v ÷ ‖v‖, where ‖v‖ is the magnitude. Its components are the direction cosines of v, cos α, cos β and cos γ, where α, β and γ are the angles between v and the positive x, y and z axes, and because û has length 1 they always satisfy cos²α + cos²β + cos²γ = 1. The unit vectors along the axes, î, ĵ and k̂, are the ones used to write results such as 0.6i + 0.8j.
How to use this calculator.
- Choose 2D for a vector in the plane or 3D for one in space. In 2D the z component is taken as exactly 0.
- Enter the components in one unit. Negative values and zeros are fine, as long as at least one component is not zero.
- Read the unit vector in i, j, k form, shown to six decimal places, with each component listed separately below it.
- Read the magnitude if what you needed was the vector's length; it is the number every component was divided by.
- Use the direction angles when you need the orientation relative to each axis, for example to resolve a force in a statics problem.
The formula.
‖v‖ = √(x² + y² + z²), the Pythagorean length of the vector, and û = (x ÷ ‖v‖, y ÷ ‖v‖, z ÷ ‖v‖). Multiplying a vector by the positive number 1 ÷ ‖v‖ changes its length to 1 and leaves its direction alone, so v can always be rebuilt as ‖v‖ × û. Each component of û is also a direction cosine: x ÷ ‖v‖ is the dot product of û with î, which equals cos α because both have length 1, and likewise for y and z. The angles are therefore α = arccos(x ÷ ‖v‖) and so on, each between 0° and 180°. That range means direction angles are unsigned. They say how far the vector is from each axis, not which side of it the vector lies on; the sign shows up instead in the angle from the other axes. In 2D the vector is treated as lying in the xy-plane, so its angle from the z-axis is always exactly 90°. The zero vector is refused, since its magnitude is 0 and û would be 0 ÷ 0.
A worked example.
Take v = (3, 4). The magnitude is √(3² + 4²) = √(9 + 16) = √25 = 5, so the unit vector is (3 ÷ 5, 4 ÷ 5), shown as 0.6i + 0.8j. As a check, 0.6² + 0.8² = 0.36 + 0.64 = 1. The direction angles are arccos 0.6 = 53.1301° from the x-axis and arccos 0.8 = 36.8699° from the y-axis, and 90° from the z-axis because the vector lies flat in the plane. In three dimensions the same steps apply to v = (2, 1, −4). The magnitude is √(4 + 1 + 16) = √21 = 4.5826, giving û = 0.436436i + 0.218218j − 0.872872k. The angles from the axes are 64.1233°, 77.3956° and 150.7941°. The last is greater than 90° because the z component is negative: the vector points away from the positive z-axis.
Frequently asked questions.
Why does (3, −4) have the same x-axis angle as (3, 4)?
Do the x and y angles of a 2D vector always add to 90°?
What should code do when asked to normalise a zero vector?
Why don't my hand-rounded components square to exactly 1?
How do I get a vector of a chosen length in the same direction?
Do I need to normalise before finding the angle between two vectors?
References& sources.
- [1]OpenStax, Calculus Volume 3 (2016 ed., web revision retrieved 2026-07-29), §2.1 ‘Vectors in the Plane’, subsection ‘Unit Vectors’ — defines u = (1/‖v‖)v and names the operation normalization; gives ‖v‖ = √(x² + y²). Open access.
- [2]OpenStax, University Physics Volume 1 (2016 ed.), §2.2 ‘Coordinate Systems and Components of a Vector’ — Equation 2.15 (2D magnitude), Equation 2.16 (direction angle), Equation 2.21 (3D magnitude √(Ax² + Ay² + Az²)). Open access, independent of the Calculus volume.
- [3]Wolfram Research, MathWorld — ‘Unit Vector’ (live revision retrieved 2026-07-29): ‘A unit vector is a vector of length 1, sometimes also called a direction vector’, with v̂ = v/|v|. Supports the normalization identity only; the entry does not cover direction cosines.
- [4]Paul Dawkins, Paul's Online Notes (Lamar University), Calculus II — ‘Dot Product’, Example 6 (direction cosines and direction angles): a = ⟨2, 1, −4⟩ gives ‖a‖ = √21 and angles 64.123°, 77.396°, 150.794°. Used as the independent cross-check for this page's direction-angle output; the values agree to every published digit.
How this page was produced
- Published by
- Quanta Calculator
- Overseen by
- Daniel, Quanta Calculator Researcher
- Primary sources
- 4 cited below
- Method
- û = v ⁄ ‖v‖ , ‖v‖ = √(x² + y² + z²)
- Published
- Last verified
Built with AI assistance and verified by automated tests against the cited sources — every worked example on this page is computed by the same code that runs the calculator. How we build and check calculators.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 1560 calculators remain free
- No billing is enabled