Unit Vectors (Normalization)

Dividing a vector by its length gives a vector of length 1 in the same direction.

e = a ÷ |a|

A zero vector has no direction, so it cannot be normalized.

Multiply a unit vector by a speed to move that fast in that direction.

Calculator

Change a value and the result and picture update instantly.

Result

Length |a|5
Unit x0.6
Unit y0.8

Animated picture

The picture follows your values. Some points and shapes can be dragged.

Use in game development

Normalize the input direction before multiplying by speed, so diagonal movement is not faster.

Code example (JavaScript)

const len = Math.hypot(dx, dy);
if (len > 0) { dx /= len; dy /= len; } // then multiply by speed

What the symbols mean

SymbolMeaning
xx
yy
lenLength |a|
uxUnit x
uyUnit y

More formulas in this category

Frequently asked questions

What is the formula for Unit Vectors (Normalization)?
The formula for Unit Vectors (Normalization) is e = a ÷ |a|. Dividing a vector by its length gives a vector of length 1 in the same direction.

Math Formula Quiz Vectors & Matrices

Sources

Checked: 2026-11-29