AI / LLM Dev Tools

vector similarity calculatorSee what each metric really measures

Paste two numeric vectors as flat JSON arrays or separated numbers. All three metrics appear together; normalization changes calculation copies only.

vector similarity calculator

Vector A

Dimensions: 0

Vector B

Dimensions: 0

Results

Enter two vectors to see the metrics and steps.

Vectors stay in this browser. No upload or model request is made.

Options

Only calculation copies are normalized. The pasted vectors stay unchanged.

Enter two vectors to begin.

An embedding score looks surprising: two vectors point the same way, but their Euclidean distance is large. The vector similarity calculator lets you check the raw components before blaming a retrieval system.

This cosine similarity calculator also shows dot product and distance. Their separate values reveal whether magnitude, direction, or both explain the difference; no text is converted into embeddings here.

Why use this vector similarity calculator?

One pair, three measurements, and enough arithmetic to audit them.

Direction and distance can disagree

The vector similarity calculator shows that scaling one nonzero vector preserves cosine similarity while changing dot product and Euclidean distance. A single score would hide that difference.

Two arrows point in the same direction from one origin, with different lengths and separated endpoints.

Normalization is an explicit experiment

Switch on L2 normalization to compare unit-length copies. The source numbers stay intact, and the calculator shows original norms beside the new dot product and distance.

Two unequal arrows become equal-length arrows along their original directions without changing the source arrows.

Read the pair before trusting a score

01

Use a numeric vector, not text

A flat JSON array or comma, space and newline-separated decimals works. Load the example to see same-direction vectors with different lengths; a natural-language sentence is not an embedding.

02

Choose whether magnitude matters

Automatic calculation waits 350 ms after edits. Turn it off for manual runs with Ctrl/Cmd+Enter. L2 normalization is off by default and changes only the numbers used for dot product and distance.

03

Inspect dimensions and steps

Check both dimension counts and original norms before reading the score. Component details reveal each product and squared difference in batches of 50; copied reports include every component.

Three metrics from one pair of components

Direction through cosine similarity

Cosine similarity divides the dot product by both norms. Equal direction gives 1 even when vector lengths differ; a zero vector has no direction, so this value stays undefined.

Magnitude through the dot product

Dot product sums corresponding component products. With normalized unit vectors it matches cosine, while raw vector lengths can raise or lower it.

Straight-line Euclidean distance

Euclidean distance takes the square root of summed squared differences. It changes under scaling unless you deliberately compare unit vectors.

Know which comparison the numbers describe

Dimensions must match
A pair with unequal component counts is rejected for every pairwise metric. The vector similarity calculator never truncates one vector or pads missing components with zeros.
Zero has no direction
Without normalization, dot product and Euclidean distance still compute for a zero vector, but cosine is marked undefined. L2 normalization of zero is rejected rather than dividing by zero.
Finite one-dimensional input only
Use 1–8,192 finite decimal components per vector in a flat JSON array or separated list. Nested arrays, NaN, Infinity and calculations beyond floating-point range are rejected.
Same dimensions do not prove comparable embeddings
The tool performs arithmetic only. Vectors from different models or configurations may use incompatible coordinate spaces, and no universal cosine threshold is assigned.
No ranking or embedding service
The vector similarity calculator handles one A/B pair. It does not turn text into embeddings, call a model, upload files, build candidate rankings, or calculate cross products.

Vector similarity calculator questions

How do I calculate cosine similarity between two vectors?

The vector similarity calculator divides the dot product by the product of the two nonzero norms. The component table shows the multiplications, while the step list shows the final division.

What is the difference between cosine similarity and Euclidean distance?

Cosine similarity measures direction and ignores length; Euclidean distance measures endpoint separation and includes length. Two vectors can share a direction yet sit far apart.

Why does dot product equal cosine similarity for normalized vectors?

After both vectors have norm 1, the denominator of cosine is 1 × 1, so dot product equals cosine similarity. Without normalization, their values can differ.

Can vectors with different dimensions be compared?

No. The dot product pairs corresponding coordinates, so A and B must have equal dimensions. This calculator reports both counts and refuses to truncate.

What happens when one vector is all zeros?

A zero vector has norm 0, so cosine would require division by zero. Dot product and Euclidean distance are still computed when normalization is off.

Need another explanation?

Try the vector similarity calculator

Use the example, then paste your own pair. The vector similarity calculator keeps the source numbers in place while you test raw and normalized comparisons.