Unit Vector Calculator
Normalize any 2D or 3D vector. Get the unit vector, the magnitude that was divided out, direction cosines and direction angles, with the working shown.
Unit Vector Calculator
Background.
The Quanta unit vector calculator normalizes a vector: it takes the components of any non-zero vector in the plane or in space and returns the vector of length exactly 1 that points in the same direction, together with the magnitude that was divided out, the three direction cosines, and the three direction angles measured from the coordinate axes. Enter the default vector v = (3, 4) and the calculator returns a magnitude of 5, a unit vector of 0.6i + 0.8j, and direction angles of 53.1301023542° from the x-axis and 36.8698976458° from the y-axis.
Normalization is the operation that separates a vector's two independent pieces of information — how long it is, and which way it points. Almost every use of a vector in physics, graphics or machine learning needs one of those two things without the other. A surface normal in a lighting calculation must be unit length or the shading is wrong by a factor equal to the normal's length. A direction of travel extracted from a joystick or a mouse drag must be normalized, or the character moves faster diagonally than along an axis — a bug so common it has a name. A force resolved into components is written as magnitude times unit vector, which is precisely why F = ‖F‖·F̂ is the standard way to state a force in a mechanics problem. In least-squares fitting and in cosine similarity, vectors are normalized so that comparisons measure direction alone and are not dominated by whichever vector happens to be longest.
The arithmetic is short: divide every component by the vector's own magnitude. The magnitude is the Pythagorean length, √(x² + y² + z²), and dividing by it scales the vector without rotating it, because scalar multiplication by a positive number never changes direction. The result satisfies a check you can always run by hand: the squares of the unit vector's components add to exactly 1. For the default example, 0.6² + 0.8² = 0.36 + 0.64 = 1.
The unit vector's components have a second name. Each one equals the cosine of the angle between the original vector and the corresponding axis, which is why they are called direction cosines, and why this page reports the angles themselves alongside them. For a vector in the plane the two angles always sum to 90°, as they do for the default example, and the angle from the z-axis is exactly 90° because a planar vector is perpendicular to the z-axis by definition.
One vector cannot be normalized: the zero vector. It has magnitude 0, so the division is 0/0, and it has no direction to preserve. This calculator rejects it with a field error instead of returning a misleading result — that limitation is stated here rather than hidden in an FAQ, because it is the only input the page refuses. Everything else works, including negative components, mixed magnitudes, and vectors whose components differ by many orders of magnitude. All components must be expressed in the same unit; the unit vector itself is dimensionless, which is exactly what makes it useful as a pure direction.
What is unit vector calculator?
A unit vector is a vector whose magnitude is exactly 1 — Wolfram MathWorld calls it 'a vector of length 1, sometimes also called a direction vector'. The unit vector in the direction of a non-zero vector v is written v̂ or û and is defined as û = v ⁄ ‖v‖, where ‖v‖ = √(x² + y² + z²) is the Euclidean magnitude of v. OpenStax Calculus Volume 3, §2.1, gives the same definition as u = (1/‖v‖)v and names the operation normalization. Because ‖v‖ is a positive scalar, dividing by it rescales the vector without rotating it, so û carries all of v's directional information and none of its size. The components of û are the direction cosines of v: û x = cos α, û y = cos β, û z = cos γ, where α, β and γ are the angles between v and the positive x, y and z axes. Since ‖û‖ = 1, those cosines always satisfy cos²α + cos²β + cos²γ = 1, which is the three-dimensional form of the Pythagorean identity and a useful check on any hand computation. The standard basis vectors î = (1, 0, 0), ĵ = (0, 1, 0) and k̂ = (0, 0, 1) are the unit vectors along the axes, and writing a vector as a sum of scaled basis vectors — for example (3, 4) as 3î + 4ĵ — is the same notation this calculator uses for its result. Normalization is undefined for the zero vector, which has magnitude 0 and no direction.
How to use this calculator.
- Pick 2D if your vector lies in the plane, or 3D if it has a z component. In 2D the z field is ignored and treated as exactly 0.
- Type the x and y components (and z in 3D mode). Negative and zero components are fine; only the all-zero vector is rejected.
- Read the unit vector û at the top — that is your answer to 'normalize this vector'.
- Read the magnitude ‖v‖ directly beneath it if what you actually wanted was the length of the vector; it is the number every component was divided by.
- Use the direction cosines (the unit vector's own components) and the direction angles α, β, γ when you need the orientation relative to each axis, for example to resolve a force or set up a direction ratio.
- Sanity-check any hand computation by squaring the three unit components and adding them: the total must be 1. If it is not, the magnitude was rounded too early.
The formula.
The calculator first forms ‖v‖² = x² + y² + z², then takes a single square root to get the magnitude ‖v‖. Doing it in that order matters: squaring and summing before rooting means there is exactly one rounding site instead of three, so the identity ‖û‖ = 1 survives to the last displayed digit. In 2D mode the z term is exactly zero and the expression collapses to OpenStax University Physics Equation 2.15, ‖v‖ = √(x² + y²); in 3D it is Equation 2.21.
Each component is then divided by that magnitude: û = (x/‖v‖, y/‖v‖, z/‖v‖). This is scalar multiplication by the positive number 1/‖v‖, and multiplying a vector by a positive scalar never changes its direction — that is the whole reason normalization works. For the worked example v = (3, 4), the magnitude is √(9 + 16) = √25 = 5 exactly, and û = (3/5, 4/5) = (0.6, 0.8).
The direction angles come from the same three numbers. Because û x = cos α by definition of the dot product with the basis vector î, the angle itself is α = arccos(û x), and likewise for β and γ. arccos returns a value in [0°, 180°], which is the correct range: a direction angle is never negative and never exceeds a straight angle. For the worked example, α = arccos(0.6) = 53.1301023542° and β = arccos(0.8) = 36.8698976458°, and those two add to exactly 90° because the vector lies in the xy-plane. The z angle is arccos(0) = 90° exactly for every 2D input.
Rounding happens only at the return boundary. Every intermediate — the sum of squares, the square root, each division, each arccos — is carried at 40 significant digits and only the returned values are rounded, to 10 decimal places. The unit vector shown in î/ĵ/k̂ notation is a separate display rendering trimmed to 6 decimal places; it is a label, and the full-precision components are listed underneath it. Nothing on this page is classified into bands or grades, so there is no threshold whose rounding could change a verdict.
The one input with no answer is the zero vector. ‖0‖ = 0, so û would be 0/0 — undefined, not merely large — and there is no direction to report. The calculator raises a field error on the x component rather than emitting NaN or silently substituting a default direction.
A worked example.
A robot is commanded to move 3 metres east and 4 metres north, and its controller needs the heading as a pure direction, separate from the distance. The displacement vector is v = (3, 4). Its magnitude is √(3² + 4²) = √(9 + 16) = √25 = 5 metres — the straight-line distance actually travelled, which is also the classic 3-4-5 right triangle. Dividing each component by 5 gives the unit vector 0.6i + 0.8j, so the controller stores the heading as (0.6, 0.8) and the distance as 5 separately. The check confirms the result: 0.6² + 0.8² = 0.36 + 0.64 = 1, so the heading really is one unit long and can be scaled by any speed without changing direction. The direction cosines are 0.6 and 0.8, giving a direction angle of 53.1301023542° from the x-axis (east) and 36.8698976458° from the y-axis (north); those two angles sum to exactly 90°, as they must for any vector lying in the plane. The angle from the z-axis is 90°, because the robot never leaves the ground plane. If the controller now wants to travel 12 metres in the same direction, it multiplies the unit vector by 12 to get (7.2, 9.6) — the whole point of separating direction from length.
Frequently asked questions.
How do I normalize a vector by hand?
What is the magnitude of a vector, and does this calculator give it?
Why can't the zero vector be normalized?
What are direction cosines and direction angles?
Does normalizing change the direction of a vector?
Is a unit vector the same as a normal vector?
Why does the calculator show a z angle of 90° for a 2D vector?
How is this different from the dot product or projection calculators?
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.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 977 calculators remain free
- No billing is enabled