Gmail filter builder

Say who the mail is from and what should happen to it. You get the search to paste into Gmail, and a filter file Gmail can import in one go. Free, no sign-in, and it never touches your inbox: none of what you type leaves this page.

Show the filter file (mailFilters.xml)

How do you import generated filters into Gmail?

Add one or more filters above, click Download filter file to save mailFilters.xml, then open Gmail on a computer and go to Settings > See all settings > Filters and Blocked Addresses > Import filters. Choose the XML file, review the rules, and click Create filters.

One filter, quickest: copy its search, paste it into the search box at the top of Gmail and press Enter. Check that the emails listed are the ones you meant. Then click Show search options (the sliders icon at the right of the search box), click Create filter, and tick the same actions you picked here. You also get to tick Also apply filter to matching conversations on the way, which sorts the mail you already have.

Several filters at once: download the file and import it. Google's filter settings are for Gmail on a computer, so do this in a browser.

Step 1

Download the filter file

Click Download filter file above. You get mailFilters.xml, which follows the format open-source Gmail filter generators use. Only the filters with at least one condition and one action go in it.

Step 2

Open Gmail's filter settings

Open Gmail on a computer. At the top right, click Settings, then See all settings, then the Filters and Blocked Addresses tab.

Step 3

Import the file

At the bottom of the page, click Import filters, choose mailFilters.xml, and click Open file.

Step 4

Create the filters

Gmail lists what's in the file. Check it, then click Create filters. Gmail creates any label in the file that doesn't exist yet. For a label inside another one, type Parent/Child and create the Parent label in Gmail first (next to Labels on the left, click Create new label); otherwise Gmail makes one label named "Parent/Child" instead of nesting it.

Step 5 (optional)

Sort the mail you already have

Google describes filters as a way to "manage your incoming mail," so a new filter starts with the next email. To include older mail, click Edit next to the filter, click Continue, tick Also apply filter to matching conversations, and click Update filter.

How the builder writes your search

Everything here uses Gmail's own search operators, from Google's search help:

Conditions in different boxes all have to match. Fill in From and Subject, and the filter only catches mail from that sender with that subject.

Why there's no Delete action

Gmail filters can delete mail, but one loose word in a delete filter quietly bins email you wanted, and you won't see it happen. This builder leaves it out on purpose. If you want mail gone from view, Skip the Inbox (Archive it) does that and keeps it searchable.

What filters can't do

A filter is a saved search. It's free, it runs forever, and for a known sender it's the right tool. But be honest about the edges before you build fifty of them:

Diagram showing a Gmail sender filter mixing an order confirmation and a flash sale into one label, versus MailManager AI sorting them into Receipts & Bills and Newsletters & Promos.
Exact-match Gmail filters are ideal for single-purpose senders; AI sorting handles senders and topics that can't be captured by one keyword.

Filter acting strange after import? Seven reasons Gmail filters stop working covers the usual causes and the fix for each. Want the full picture on labels, from filters to AI? See how to automatically label emails in Gmail, or compare MailManager plans ($0–$8/mo).

When filters run out: sort the rest by topic. MailManager is AI that sorts your Gmail into categories you choose, as labels inside the Gmail you already use. Your rules run first and cost nothing; the AI only sorts what they miss, like the receipt from a shop you've never ordered from. It gets some wrong, and you correct them in your history. Free plan with five ready-made categories, 25 sorts of new mail a month and 50 of older mail once, no card.

Try MailManager free →

FAQ

Does this tool connect to my Gmail?

No. There's no sign-in and no Google permission. The page builds the search and the file in your browser; none of what you type is sent anywhere. You paste or import them into Gmail yourself.

How do I import filters into Gmail?

On a computer, open Gmail, click Settings, then See all settings, then Filters and Blocked Addresses. At the bottom, click Import filters, choose the file, click Open file, then Create filters.

Will imported filters sort the email I already have?

Not by themselves. Filters act on incoming mail. Edit each filter after import and tick Also apply filter to matching conversations to include older mail.

How do I make one filter match several senders?

Separate them with commas in the From box. The builder writes from:(a@shop.com OR b@shop.com), which matches either one.

Can I edit the filter file by hand?

Yes. Google says the exported file is "a .xml file, which you can edit in a text editor if you'd like." The one from this page is in the same format.

Can a Gmail filter sort email by what it's about?

No. A filter matches the senders and words you type. Gmail's inbox tabs sort automatically, but Google says "You can't create your own categories." Sorting by topic into your own labels takes AI, such as MailManager.

Sources

All checked November 24, 2026. The file format follows two open-source filter generators that write Gmail's import format.