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.
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:
- 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.
- Encode. The MiniLM encoder produces one embedding per token.
- 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ᵢ). - 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
Frequently asked questions
Sources & references
- Hugging Face — sentence-transformers/all-MiniLM-L6-v2 model card (384-dim, mean pooling, L2 normalisation)
- Hugging Face — Xenova/all-MiniLM-L6-v2 (ONNX build referenced by Transformers.js)
- Transformers.js docs — feature-extraction pipeline, mean pooling & normalize options
- Reimers & Gurevych (2019) — Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks (EMNLP)
Model details and the pooling/normalisation recipe were last cross-checked against these sources on 2026-07-13.
Related tools
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.