Skip to content
induwara.lk
Premium
induwara.lkDeveloper · AI

Text Embedding Generator — free, no API key

Paste any text and get its 384-dimension embedding vector from all-MiniLM-L6-v2 — the numbers behind semantic search and RAG. Copy or download as JSON, CSV, or a Python list, and compare two texts by cosine similarity. No API key, no signup.

By Induwara AshinsanaUpdated Jul 13, 2026
Generate a text embedding
all-MiniLM-L6-v2 · 384-d
21/2,000

8 tokens

27/2,000

8 tokens

Try a sample

Output format

Precision

Paste text and press Generate embedding to turn it into a 384-dimension vector you can copy or download. Add a second text to also get the cosine similarity between the two. The maths panel below runs entirely in your browser and works even before you generate anything.

See the comparison maths (runs in your browser)

Cosine similarity is what turns two embeddings into one comparable number. This worked example uses two toy unit vectors so you can check it by hand:

a = [0.6, 0.8, 0]
‖a‖ = 1.0000
b = [0, 0.8, 0.6]
‖b‖ = 1.0000
  • a · b = (0.6·0.0) + (0.8·0.8) + (0.0·0.6) = 0.6400
  • cos(a, b) = (a · b) / (‖a‖ · ‖b‖) = 0.6400

Both formulas agree: 0.64 — the "related" band. Because the vectors are unit length, the full cosine formula and the plain dot product give the same answer.

Your text is sent once to the server only to compute the vector — it is never stored, logged, or shared. Sources are cited below the tool.

How it works

An embedding maps text to a fixed-length list of numbers so that meaning becomes geometry: two texts that mean similar things land close together, and comparing them is just measuring the angle between their vectors. This tool uses sentence-transformers/all-MiniLM-L6-v2 (UKP Lab · Reimers & Gurevych, 2019), a sentence-transformer that outputs a 384-dimension vector. The model runs on our server through the Hugging Face Inference API — you never download model weights into your browser — and the same weights back the ONNX build Xenova/all-MiniLM-L6-v2 referenced in the model documentation.

The pipeline has four documented stages:

  1. Tokenize.The text is split into subword tokens by the model's WordPiece tokenizer. Sequences over 256 tokens (~190 English words) are truncated; the tool warns you when that is likely.
  2. Encode. The MiniLM encoder produces one embedding per token.
  3. Mean-pool. Token embeddings are averaged using the attention mask so padding is excluded: for token vectors tᵢ and mask mᵢ, the sentence vector is v = (Σ mᵢ·tᵢ) / (Σ mᵢ).
  4. L2-normalise. v ← v / ‖v‖₂, so every vector has unit length. This is why the magnitude shown next to each result is ≈ 1.0000.

To compare two texts the tool computes cosine similarity, cos(a,b) = (a·b) / (‖a‖·‖b‖), clamped to the range [-1, 1] to absorb floating-point drift. Because both vectors are unit length, this reduces to the dot product Σ aᵢbᵢ— the tool computes it both ways and confirms they agree, which is also a live check that the output really is normalised. A score of ≥ 0.85 is labelled "near-duplicate / paraphrase", 0.50–0.85 "related", 0.20–0.50 "loosely related", and below 0.20 "unrelated". The bands are a reading aid; the number is the source of truth.

Worked examples

Cosine on a toy 3-D vector (hand-reconcilable)

  1. a = [0.6, 0.8, 0.0] → ‖a‖ = √(0.36 + 0.64) = 1.0
  2. b = [0.0, 0.8, 0.6] → ‖b‖ = √(0.64 + 0.36) = 1.0
  3. a · b = (0.6·0.0) + (0.8·0.8) + (0.0·0.6) = 0.64
  4. cos(a, b) = 0.64 / (1.0 × 1.0) = 0.6400 → band 'related'

The real model is 384-D and can't be pooled by hand, so this verifies the comparison maths the tool uses. Open the 'See the comparison maths' panel in the tool to watch it run live.

Identity & self-similarity (determinism)

  1. Text A = Text B = 'Sri Lanka income tax calculator'
  2. The model is deterministic, so Vector A == Vector B exactly.
  3. cos(a, a) = Σ aᵢ² = ‖a‖² = 1.0000
  4. The tool displays exactly 1.0000 for identical text.

Load the 'Identical' sample to see this — it is the strongest correctness check the tool can make without hand-pooling.

Paraphrase vs unrelated (directional check)

  1. A = 'A cat sat on the mat.' B = 'A feline rested on the rug.'
  2. Expected: high cosine (~0.6–0.8), band 'related' — a paraphrase.
  3. Now B = 'The quarterly VAT filing deadline is the 20th.'
  4. Expected: cosine < 0.2, band 'unrelated'.

These are model-produced, not hand-computed. The check is directional: the paraphrase must score far higher than the unrelated pair. Load the 'Paraphrase' and 'Unrelated' samples to compare.

Frequently asked questions

Sources & references

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a bug, edge case, or want to suggest an improvement?

Email me at [email protected] — most fixes ship within 24 hours.