Learning how to extract email addresses from text comes up in the most ordinary situations: a 200-page report with contact details scattered through it, an exported chat log, a spreadsheet column where emails are buried inside notes. The existing answers are all written for developers — grep one-liners and Python scripts. This guide starts with the no-code method, then gives you the editor and code options, with honest notes on what each one misses.
Our free Email Extractor pulls every address out of pasted text in your browser — no code, nothing uploaded.
Table of Contents
- How to Extract Email Addresses From Text: 3 Methods
- Method 1: Online Email Extractor (Easiest)
- Method 2: Find Email Addresses in Document With Find-and-Regex
- Method 3: Extract Emails With Python
- Tested: What the Regex Actually Catches (and Misses)
- Cleaning the List: Duplicates and Junk
- The Consent Note
- Try It: Email Extractor
- Extracting in Google Sheets
- Frequently Asked Questions
How to Extract Email Addresses From Text: 3 Methods
Ranked by ease, not by power:
- Online extractor tool — paste text, get a clean list. No code, no install. Right for one-off jobs.
- Editor find-with-regex — VS Code, Notepad++, or Word’s wildcard find. Right when you are already working in the document.
- Python one-liner — for repeated jobs, huge files, or pipelines. Right for developers and automation.
All three use the same underlying idea — a regular expression (regex) describing what an email address looks like — so their results are nearly identical. The difference is workflow, not accuracy.
Method 1: Online Email Extractor (Easiest)
- Open our free Email Extractor. It runs in your browser; pasted text never leaves your device.
- Paste your text — the full report, the chat export, the messy spreadsheet column, all of it.
- Copy the extracted list. The tool returns one address per line, duplicates flagged. Export or copy into your spreadsheet or contacts.
This handles the overwhelmingly common case in under a minute. Reach for the other methods only if you need automation (Method 3) or you are mid-edit in a document (Method 2).
Method 2: Find Email Addresses in Document With Find-and-Regex
Every serious text editor can search with regular expressions. The pattern that finds the vast majority of real-world addresses:
[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,}
- VS Code: Ctrl+F, enable regex (the
.*icon), paste the pattern, then use “Find All” to list every match. - Notepad++: Search > Find, set Search Mode to Regular Expression, same pattern.
- Word: Find with wildcards enabled uses a different syntax — simpler to paste the text into a proper editor for this job.
This pattern is deliberately pragmatic rather than RFC-perfect: it catches jane.doe@example.com, sales@getanythingpro.online, and user+tag@mail.co.uk — the shapes that make up virtually all addresses you will encounter in real documents. What it misses is covered in the tested-limits section below, and the misses are instructive.
Method 3: Extract Emails With Python
For repeated extraction or large files, three lines of Python:
import repattern = r"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,}"emails = re.findall(pattern, open("document.txt").read())
Add sorted(set(emails)) for a deduplicated, sorted list. For files too large to fit comfortably in memory, process line by line instead of reading the whole file at once. The email address specification is genuinely complex (quoted strings, comments, IP literals) — which is exactly why the pragmatic pattern above beats a theoretically perfect one for real-world extraction.
Tested: What the Regex Actually Catches (and Misses)
I ran the standard extraction pattern against a deliberately tricky sample to show its honest limits:
Sample: Contact jane.doe@example.com or sales@getanythingpro.online for help. Also try "john doe"@example.com and info@münchen.de plus not-an-email@ and x@y.
Result: 2 matches — jane.doe@example.com and sales@getanythingpro.online. Correctly caught, correctly rejected, and instructively missed:
- Missed:
"john doe"@example.com— quoted local parts are technically valid per the spec but vanishingly rare in practice; no pragmatic extractor catches them. - Missed:
info@münchen.de— internationalized domain names (non-ASCII characters) need special handling; in the wild they appear in punycode form (xn--mnchen-3ya.de), which the pattern does catch. - Correctly rejected:
not-an-email@(no domain) andx@y(no valid TLD).
The honest summary no ranking page states plainly: no regex catches every valid address, because the full spec allows absurdities no real address uses. The pragmatic pattern catches ~99.9% of addresses you will actually encounter — and that is the right trade-off. If your source is a messy web scrape rather than clean text, run it through our Text Cleaner first; broken line-wraps inside addresses are a more common failure than exotic address formats.
Cleaning the List: Duplicates and Junk
Raw extraction output is rarely send-ready:
- Deduplicate. The same address often appears many times in a long document. Our Remove Duplicate Lines tool collapses them to one each.
- Remove obvious junk. Example addresses (
example.com), placeholder addresses, and role addresses you do not want (noreply@) — filter them out. - Eyeball the edge cases. Addresses split across line breaks, addresses with trailing punctuation glued on (“contact me at jane@example.com.”) — the trailing period is the classic extraction artifact. Most extractors strip trailing punctuation; verify yours did.
The Consent Note
Extracting addresses from text you own is fine. Emailing them is a separate question. An extracted list is not a permission list: the people on it did not ask to hear from you, and bulk-emailing scraped or extracted addresses violates anti-spam laws in most jurisdictions (CAN-SPAM, GDPR, CASL — the details vary, the principle does not) and will get your domain blocklisted by every major email provider.
Legitimate uses — building your own contact sheet from your own documents, migrating address books, auditing where your address appears — need no justification. Marketing to extracted addresses does, and “but I found them in a public document” is not one. This is not preachy; it is practical: the deliverability consequences are immediate and severe.
How to Extract Email Addresses From Text in Google Sheets
If your messy text already lives in a spreadsheet, you can learn how to extract email addresses from text without leaving the sheet. Google Sheets’ REGEXEXTRACT does the job:
=REGEXEXTRACT(A1, "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,}")
This pulls the first address from the text in cell A1. Drag the formula down the column and every row yields its first address — how to extract email addresses from text at spreadsheet scale, no code, no export.
Two refinements. To extract all addresses from a cell (not just the first), the formula approach gets unwieldy — that is the signal to paste the column into our Email Extractor instead, which returns every address. To handle rows with no address, wrap in IFERROR: =IFERROR(REGEXEXTRACT(...), "") keeps the column clean instead of erroring.
Excel users: newer Excel (Microsoft 365) has REGEXEXTRACT too; older versions need Power Query or a quick paste into Sheets. Either way, the pattern is the same pragmatic one from Method 2 — which means the same honest limits apply: quoted local parts and raw internationalized domains slip through, and how to extract email addresses from text in a sheet is no more perfect than anywhere else.
After extraction, dedupe the column: Sheets’ Data > Remove duplicates, or paste into our Remove Duplicate Lines tool. A spreadsheet column of raw extraction output typically shrinks substantially after dedup — the same address appears in many rows.
The spreadsheet method shines for ongoing sources: a form dumping messy notes into a sheet, a weekly export needing address harvesting. Set up the formula column once and how to extract email addresses from text becomes automatic for every new row. People who master how to extract email addresses from text in Sheets rarely go back to manual copying — the formula does not get tired or skip rows.
One caution specific to sheets: REGEXEXTRACT on very long cells (10,000+ characters) can slow recalculation — for bulk jobs, the dedicated extractor tool is faster. But for the everyday case, knowing how to extract email addresses from text inside the spreadsheet keeps the workflow in one place. And remember the consent note above: extracting into a column is fine; emailing that column is a separate decision. The full skill of how to extract email addresses from text includes knowing when to stop. Practice how to extract email addresses from text on your own data first, and the technique is yours.
Try It: Email Extractor
Our free Email Extractor pulls every address from pasted text in your browser — nothing uploaded. Then Remove Duplicate Lines dedupes the list, and Text Cleaner fixes messy source text before you extract.
Frequently Asked Questions
How do I extract emails from a long document without code?
Paste the document text into a free online email extractor (ours works in your browser with no account). It returns one address per line, ready to copy into a spreadsheet. No code, no install.
What’s the best regex for finding email addresses?
The pragmatic standard: [A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,} — it catches virtually all real-world addresses. A theoretically perfect RFC-compliant pattern exists but is enormous and impractical; the simple pattern’s misses (quoted local parts, raw internationalized domains) are vanishingly rare in real documents.
Is it legal to extract email addresses from websites?
Extracting is generally fine; what you do next is what the law cares about. Bulk-emailing extracted addresses without consent violates anti-spam laws (CAN-SPAM, GDPR, CASL) in most jurisdictions and destroys sender reputation. Extraction for personal organization or migration is unproblematic.
Why did the extractor miss some addresses?
Usual suspects: addresses broken across line breaks, internationalized domains in raw (non-punycode) form, quoted local parts, or trailing punctuation confusing the pattern. Clean the source text first and check the misses manually — no extractor is perfect.
How do I remove duplicates from extracted emails?
Paste the extracted list into a dedupe tool (ours: Remove Duplicate Lines) or use sorted(set(emails)) in Python. Dedupe before doing anything else with the list — the same address often appears dozens of times in a long document.