ListFerret mascot

Home › Guides › Extract Email Addresses from Text: 5 Ways

How to Extract Email Addresses from Text, a Web Page or a Document

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.

The fastest way to extract an email address from text

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&#64;example.net · Careers: jobs@example.com</p>
 <p>Logo file: logo@2x.png - Support again: SUPPORT@example.com</p>
</footer>
The Email Extractor showing four unique email addresses found in a sample website footer, with 6 matches and 2 duplicates
The extractor finds 6 matches in the sample and returns 4 unique addresses. The example text is invented.
What is in the textWhat happens
Support@Example.com inside a mailto: link, and again as visible text, and again as SUPPORT@example.comThree matches, one address after case-insensitive duplicate removal: support@example.com
sales [at] example [dot] orgDecoded to sales@example.org
press&#64;example.net (the @ sign written as an HTML entity)Decoded to press@example.net
jobs@example.comFound as is
logo@2x.pngRejected: .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.

What an email address actually looks like

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:

Method 1: copy the page source (best for websites)

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:

  1. Open the page and press Ctrl+U (Cmd+Option+U on a Mac) to view the source.
  2. Select all with Ctrl+A, copy, and paste into the extractor.
  3. Repeat for the other pages that matter, such as Contact, Team and About.

Method 2: copy from documents and spreadsheets

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.

Method 3: search with a regular expression

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.

Method 4: a few lines of Python

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.

Method 5: handle hidden and obfuscated addresses

Many sites disguise addresses to avoid spam bots. These are the common disguises and how each is handled:

DisguiseExampleHandling
Spelled outname [at] site [dot] com, name (at) site (dot) comThe extractor’s Decode obfuscated addresses option converts these back
HTML entitiesname&#64;site.com (a numeric entity for @)Decoded by the same option
URL-encodedname%40site.comDecoded by the same option
Cloudflare email protectionThe page shows [email protected]The real address is stored in the source as a hexadecimal string (see below)
Image of textAn address drawn as a pictureCannot 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.

Why some addresses seem to be missing

SymptomLikely reason
Nothing found on a page that clearly shows an addressYou copied the visible text, not the source, and the address is loaded by a script or protected
An address with an unusual ending is droppedThe 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 offLine 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.comThanksNo space after the address in the original. The validator trims many of these automatically
Too many resultsFilenames such as image@2x.png or example data. Use the exclude filter, or keep only the domain you want

Clean the list afterwards

Use the addresses responsibly

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.

Frequently asked questions

Is the Email Extractor safe to use with private data?

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.

Can I extract emails from a PDF?

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.

Why does the extractor return fewer addresses than it found matches?

Duplicates are removed, ignoring case. In the worked example above, six matches become four unique addresses.

Can it find addresses written like name [at] example [dot] com?

Yes. Keep “Decode obfuscated addresses” on and it converts spelled-out, entity-encoded and URL-encoded forms back into normal addresses.

Does it validate that an address really exists?

No. It checks that text has the shape of an address with a plausible ending, not that the mailbox exists or accepts mail.

Try it now: use the free Email Extractor - private, instant and runs in your browser. Open Email Extractor →

More guides

Share this page: XFacebookLinkedInRedditEmail