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.
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.
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.
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.
Import the file
At the bottom of the page, click Import filters, choose mailFilters.xml, and click Open file.
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.
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:
- From, To, Subject become
from:,to:andsubject:. Two senders becomefrom:(a@shop.com OR b@shop.com). - Several words together go in quotes, which Gmail treats as an exact phrase:
subject:"order shipped". This builder drops any double quote you type inside a phrase, so the phrase stays intact. - Doesn't have puts a minus in front:
-urgent. Several become-urgent -invoice, which leaves out mail with either word. - Has attachment adds
has:attachment. - Typing
ORin capitals between two choices works the same as a comma.
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:
- Exact matches only. Google's accessibility guide describes filter actions as what happens "when a message is an exact match for your search criteria."
invoicemisses "Your payment confirmation." - Only what you predicted. The shop you first buy from next month isn't in any filter yet.
- No idea what an email is about. A filter can't tell a shipping update from a sale email when both come from the same address.
- Replies are on their own. Google: a reply to a filtered message "will only be filtered if it meets the same search criteria."
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).
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.
- Gmail Help: Create rules to filter your emails (creating, editing, exporting and importing filters; replies)
- Gmail Help: Refine searches in Gmail (search operators)
- Gmail Help: Use Gmail with a screen reader (filter actions, exact match)
- Gmail Help: Organize your emails into categories
- gmailctl: Gmail filter export format (filter properties and actions)
- gmail-britta: Gmail filter generator (doesNotHaveTheWord and hasAttachment properties)