Audited 29 Jul 2026·Last updated 31 Jul 2026·4 citations·Tier 2·0 uses

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

Vector dimension
May be negative or zero. All components must be in the same unit.
May be negative or zero.
Used only in 3D mode. Ignored (treated as 0) when the dimension is set to 2D.
Unit vector û
0.6i + 0.8j
The vector of length 1 pointing the same way as v, written in î/ĵ/k̂ notation. Components are shown to 6 decimal places; the exact values are listed below. The zero vector has no direction and is rejected rather than normalized.
Magnitude ‖v‖
5
û x component (cos α)
0.6
û y component (cos β)
0.8
û z component (cos γ)
0
Direction angle α from x-axis
53.1301°
Direction angle β from y-axis
36.8699°
Direction angle γ from z-axis
90°

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.

  1. 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.
  2. Type the x and y components (and z in 3D mode). Negative and zero components are fine; only the all-zero vector is rejected.
  3. Read the unit vector û at the top — that is your answer to 'normalize this vector'.
  4. 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.
  5. 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.
  6. 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.

û = v ⁄ ‖v‖ , ‖v‖ = √(x² + y² + z²)

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.

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.

vx3
vy4
vz0
dimension2

Frequently asked questions.

How do I normalize a vector by hand?
Compute the magnitude first, then divide every component by it. The magnitude of v = (x, y, z) is √(x² + y² + z²), and the unit vector is û = (x/‖v‖, y/‖v‖, z/‖v‖). For v = (3, 4), the magnitude is √(9 + 16) = 5, so û = (3/5, 4/5) = (0.6, 0.8). The one habit worth building is to keep the magnitude in exact or high-precision form until the very last step: if you round √30 to 5.48 and then divide three components by it, the squares of your unit components will not add to 1, and the error compounds through whatever you do next. Always finish by checking that the squares of the components sum to 1 — that single check catches almost every arithmetic slip.
What is the magnitude of a vector, and does this calculator give it?
The magnitude ‖v‖ is the length of the vector: the straight-line distance from its tail to its tip, computed as √(x² + y² + z²). Yes — magnitude is reported directly beneath the unit vector on this page, because it is the number the normalization divides by, so it is computed either way. If the magnitude is all you need, read that output and ignore the rest. In two dimensions the formula is exactly the Pythagorean theorem applied to the components, which is why the vector (3, 4) has magnitude 5; in three dimensions it is the same idea applied twice, once in the xy-plane and once against the z component.
Why can't the zero vector be normalized?
Because normalization divides by the magnitude, and the zero vector has magnitude 0. The division 0/0 is undefined rather than infinite, and more fundamentally there is no direction to preserve: the zero vector points nowhere, so no unit vector can point 'the same way'. Some software silently returns (0, 0, 0) or (1, 0, 0) in this situation, which is a common source of hard-to-find bugs in graphics and physics code, because the wrong answer is a perfectly plausible-looking vector. This calculator raises an explicit input error instead. If you hit this in real code, the fix is upstream: find out why the vector collapsed to zero — a degenerate triangle, two identical points, a cancelled force — and handle that case deliberately.
What are direction cosines and direction angles?
The direction angles α, β and γ are the angles between your vector and the positive x, y and z axes. Their cosines are called the direction cosines, and here is the neat part: the direction cosines are exactly the components of the unit vector. So normalizing a vector and finding its direction cosines are the same computation. Because the unit vector has length 1, the identity cos²α + cos²β + cos²γ = 1 always holds, which gives you a free check on any hand calculation. For a vector lying in the xy-plane, γ is always 90° and α + β = 90°. Direction angles are the standard way engineering statics texts specify the orientation of a force in three dimensions.
Does normalizing change the direction of a vector?
No, and that is the entire point. Normalization multiplies the vector by the positive scalar 1/‖v‖, and multiplying by any positive number leaves direction untouched while scaling length. If you multiplied by a negative number you would reverse the direction, which is why the magnitude — always positive for a non-zero vector — is the right thing to divide by. After normalizing, you can recover the original vector exactly by multiplying the unit vector by the magnitude: v = ‖v‖ · û. That decomposition, 'length times direction', is how forces, velocities and surface normals are written throughout physics and computer graphics.
Is a unit vector the same as a normal vector?
Not quite, and the similar words cause real confusion. A unit vector is any vector of length 1. A normal vector is a vector perpendicular to a surface or a line — it describes an orientation relationship, and it does not have to be length 1. The phrase you often see, 'unit normal', means both at once: perpendicular to the surface and normalized to length 1. Lighting models in computer graphics require unit normals specifically, because the shading calculation uses the dot product of the normal with the light direction as a cosine, and that interpretation only holds when both vectors have length 1.
Why does the calculator show a z angle of 90° for a 2D vector?
Because a vector lying in the xy-plane genuinely is perpendicular to the z-axis, and the angle between perpendicular directions is 90°. In 2D mode the calculator treats your vector as the space vector with z = 0, which is the standard embedding of the plane in space, so the direction cosine cos γ = 0 and γ = arccos(0) = 90° exactly. It is a real result rather than a placeholder. If it is not useful to you, ignore it — the two in-plane angles α and β are the ones that describe a planar direction, and they always sum to 90°.
How is this different from the dot product or projection calculators?
This page works on a single vector and asks 'which way does it point, and how long is it'. The dot product and angle-between calculators take two vectors and measure how they relate to each other. The vector projection calculator also takes two vectors and asks how much of one lies along the other. They share machinery — every one of them needs magnitudes, and the projection and angle formulas are usually written using unit vectors — but they answer different questions. If you are normalizing before comparing many vectors by direction alone, the cosine similarity calculator does the normalization and the comparison in one step.

In this category

Embed

Quanta Pro

Paid features are coming later.

  • All 977 calculators remain free
  • No billing is enabled
Coming soon