Home › Guides › Extract Email Addresses from Text: 5 Ways
You have a page, a document or a messy export full of text, and you need the email addresses out of it. Doing it by eye is slow and you will miss some. This guide shows five reliable ways to extract email addresses from text, from a one-step tool to a few lines of code, explains why some addresses seem to be missing, and covers how to clean and use the list responsibly.
Copy the text, paste it into the Email Extractor and the addresses appear immediately. Because the processing happens in your browser, nothing you paste is uploaded. Here is a worked example using a made-up website footer that contains the kinds of things that usually trip up a simple search:
<footer>
<p>Questions? Email <a href="mailto:Support@Example.com">support@example.com</a> or sales [at] example [dot] org.</p>
<p>Press: press@example.net · Careers: jobs@example.com</p>
<p>Logo file: logo@2x.png - Support again: SUPPORT@example.com</p>
</footer>

| What is in the text | What happens |
|---|---|
Support@Example.com inside a mailto: link, and again as visible text, and again as SUPPORT@example.com | Three matches, one address after case-insensitive duplicate removal: support@example.com |
sales [at] example [dot] org | Decoded to sales@example.org |
press@example.net (the @ sign written as an HTML entity) | Decoded to press@example.net |
jobs@example.com | Found as is |
logo@2x.png | Rejected: .png is not a valid email ending, so it is a filename, not an address |
Result: 6 matches, 2 duplicates removed, 4 addresses. Those figures are what the tool reports for this exact sample.
Knowing the shape of an address explains why extraction sometimes misses or over-matches. In practice an address has a local part, an @ sign, and a domain:
., _, %, + and -. A dot cannot be first, last or doubled..com, .org or a country code. This is why logo@2x.png is not an address.name+shop@gmail.com is delivered to name@gmail.com, so two different-looking addresses can be the same inbox.What you see on a web page is only part of what is in it. Contact links are usually stored as mailto: links, and some addresses are in attributes that never show on screen. To capture them:
For Word files, PDFs and spreadsheets, open the file, select everything and copy. Scanned PDFs are images, not text, so run them through OCR first. You can also save documents as .txt or .csv and drop several files at once onto the extractor’s input box.
Editors such as VS Code and Notepad++ can search with regular expressions. Turn on regex mode and search for:
[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}
This matches the common shape of an address. It is a practical filter, not a perfect validator: it will accept some things that are not deliverable and ignore the rare unusual forms. On the command line the same pattern works with grep:
grep -Eoh "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}" *.txt | sort -u
In Google Sheets, =REGEXEXTRACT(A1, "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}") returns the first address in a cell.
import re
text = open("page.html", encoding="utf-8").read()
pattern = r"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}"
emails = sorted(set(re.findall(pattern, text.lower())))
print("\n".join(emails))
Lower-casing and using set removes duplicates. This is worth doing if you repeat the job often or process many files.
Many sites disguise addresses to avoid spam bots. These are the common disguises and how each is handled:
| Disguise | Example | Handling |
|---|---|---|
| Spelled out | name [at] site [dot] com, name (at) site (dot) com | The extractor’s Decode obfuscated addresses option converts these back |
| HTML entities | name@site.com (a numeric entity for @) | Decoded by the same option |
| URL-encoded | name%40site.com | Decoded by the same option |
| Cloudflare email protection | The page shows [email protected] | The real address is stored in the source as a hexadecimal string (see below) |
| Image of text | An address drawn as a picture | Cannot be extracted as text; retype it or use OCR |
How Cloudflare’s protection works. The page source contains an attribute such as data-cfemail="…" with a string of hexadecimal characters. The first byte is a key, and every following byte is the address character XOR-ed with that key. A browser decodes it with a small script after the page loads, which is why bots reading raw HTML do not see the address. Paste the page source (Method 1) into the extractor and it performs the same decoding.
| Symptom | Likely reason |
|---|---|
| Nothing found on a page that clearly shows an address | You copied the visible text, not the source, and the address is loaded by a script or protected |
| An address with an unusual ending is dropped | The top-level domain check rejected a new or uncommon ending. Turn off “Validate top-level domain” and check the results by eye |
| Part of an address is cut off | Line breaks or spaces were inserted when copying from a PDF. Copy again or join the lines first |
Addresses stuck to the next word, such as jane@x.comThanks | No space after the address in the original. The validator trims many of these automatically |
| Too many results | Filenames such as image@2x.png or example data. Use the exclude filter, or keep only the domain you want |
Sales@x.com is the same inbox as sales@x.com.@yourcompany.com, or exclude your own domain.info@, support@ and noreply@ if you want individual contacts only.An address in public text is still personal data when it identifies a person. Laws such as the GDPR and the UK’s PECR, the US CAN-SPAM Act and Canada’s CASL restrict unsolicited marketing, and many require prior consent, a clear opt-out and honest sender details. Extracting addresses is text processing; what matters is what you do next. Use extracted addresses for legitimate purposes, such as cleaning your own lists or contacting people who expect to hear from you, and honour unsubscribe requests. This is general information, not legal advice.
The extraction runs in your browser, so the text you paste is not uploaded to a server. That makes it suitable for lists you would rather not share with an online service.
Yes, if the PDF contains real text: open it, select all, copy and paste into the extractor. If the PDF is a scan, run OCR first because a scan is just an image.
Duplicates are removed, ignoring case. In the worked example above, six matches become four unique addresses.
Yes. Keep “Decode obfuscated addresses” on and it converts spelled-out, entity-encoded and URL-encoded forms back into normal addresses.
No. It checks that text has the shape of an address with a plausible ending, not that the mailbox exists or accepts mail.