Free tool, no signup

Gmail filter generator

This free Gmail filter generator turns a few plain choices into filters Gmail can import. Set who an email comes from, what it says and what Gmail should do with it. You get a search string to test each filter and one mailFilters.xml file that imports them all, built in your browser so nothing you type is sent anywhere.

Gmail filter generator

Add a starter filter

Click or tap a filter's name to rename it. Gmail doesn't show filter names, so the file keeps each one as a note above its filter.

Your filters1newest first

  1. Receipts

    Ready
    When an email matches

    Separate options with commas. Any one of them matches.

    Separate options with commas. Any one of them matches.

    Gmail search operators work here too.

    Any of these words keeps an email out.

    Do this

    Create new labels in Gmail before importing.

    Gmail needs this address verified under Forwarding first.

    Test Receipts in Gmail search

    subject:(receipt OR invoice OR "order confirmation")

1 of 1 filter is ready: Receipts. Download the file, then in Gmail open Settings, See all settings, Filters and Blocked Addresses, and click Import filters.

mailFilters.xml
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
  <title>Mail Filters</title>
  <id>tag:mail.google.com,2008:filters:</id>
  <updated>2026-10-11T00:00:00Z</updated>
  <author>
    <name>Construct Gmail filter generator</name>
    <email>[email protected]</email>
  </author>
  <!-- Receipts -->
  <entry>
    <category term="filter"></category>
    <title>Mail Filter</title>
    <content></content>
    <apps:property name="subject" value="(receipt OR invoice OR &quot;order confirmation&quot;)"></apps:property>
    <apps:property name="label" value="Receipts"></apps:property>
    <apps:property name="shouldArchive" value="true"></apps:property>
  </entry>
</feed>

Filters match words, so a client asking for a quote and a cold pitch that use the same words end up in the same place. Construct reads each new email, sorts it into labels like Reply needed and FYI, and drafts the replies for you to check and send, from $9 a month.

Let Construct sort your inbox

Gmail filter syntax cheat sheet

The generator writes these operators for you. They also work typed straight into Gmail's search bar or the Has the words box.

OperatorWhat it matchesExample
from:The sender, a full address or a domainfrom:@acme.com
to:A recipientto:[email protected]
subject:Words in the subject linesubject:invoice
OREither term, written in capitalsfrom:([email protected] OR [email protected])
-Leaves out emails with the wordnewsletter -unsubscribe
" "An exact phrase"order confirmation"
( )Groups terms togethersubject:(receipt OR invoice)
has:attachmentEmails with any attachmenthas:attachment from:@bank.com
filename:An attachment name or typefilename:pdf
larger: / smaller:Email size in bytes, K or Mlarger:10M
list:Mailing list emailslist:[email protected]

Frequently asked questions

How do I import a filters XML file into Gmail?

Open Gmail on a computer, click the gear icon and choose See all settings. On the Filters and Blocked Addresses tab, click Import filters at the bottom, choose the mailFilters.xml file and click Open file. Tick the filters you want, then click Create filters.

How do I filter emails from multiple senders or a whole domain?

Type the addresses in From, separated by commas, and the generator joins them with OR, which is the form Gmail needs: from:([email protected] OR [email protected]). For everyone at a company, enter the domain on its own, like @acme.com. Gmail has no wildcard such as *, and the domain does the same job.

Will a new filter sort the emails I already have?

Not on its own, because filters act on mail as it arrives. To sort older mail, open Settings, Filters and Blocked Addresses, click edit next to the filter, click Continue, tick Also apply filter to matching conversations and click Update filter.

Can I create Gmail filters on an iPhone or Android phone?

Not in the Gmail app, which can't create, edit or import filters. You can build the file on your phone with this page, then import it from Gmail in a browser on a computer.

Can a Gmail filter delete emails after 30 days?

No. A filter runs once, when an email arrives, so a rule like older_than:30d never matches new mail. To clear old mail, search for older_than:30d with your other conditions, select all the results and delete them, and repeat when you need to.

Should I create my labels before importing?

Yes, that's the safe order. Create any new label in Gmail first, under Settings, Labels, Create new label, and type the name here exactly the same way, capitals included. For a nested label, use a slash, like Clients/Acme.

Can a filter tell an urgent email from one that can wait?

Not really. A filter only checks the sender, the subject, words in the email and a few properties like size and attachments. It can't tell a client asking for a quote from a sales pitch that uses the same words. That kind of sorting needs something that reads the email, which is what an AI assistant like Construct does.

Is anything I type sent to Construct?

No. The generator builds the search strings and the XML file in your browser, and this part of the page is excluded from our analytics and session recordings. We only count that a file was copied or downloaded, never what was in it.

More free tools

See all free tools