What this calculator does
Cosine similarity works out angular similarity between two vectors, from −1 (opposite) to 1 (same direction). Enter your own figures above and the answer updates as you type: nothing is fixed in the code, so the result reflects exactly the numbers you supply.
The formula this calculator evaluates is printed under the tool and explained below, so you can check the working by hand or reuse it in a spreadsheet.
The formula
Formulacos θ = (a · b) / (‖a‖‖b‖) = Σaᵢbᵢ / (√Σaᵢ² · √Σbᵢ²)
The inputs explained
| Field | What to enter |
|---|---|
| Vector A (comma separated) | A list of numbers, separated by commas or spaces. |
| Vector B (comma separated) | A list of numbers, separated by commas or spaces. |