Wow. Just minutes after expressing my frustrations about being unable to control the order of Gmail filters, I figured out a simple workaround. As it turns out, Gmail Labs has a “Filter import/export” function that makes it all possible.
For context, e-mail filters can be a great tool for sorting incoming messages. The good news for Gmail users is that Google introduced filters (via Gmail Labs) awhile back, and last summer they took the filtering functionality out of beta.
Unfortunately, there’s no way to control the order in which your filters are applied. Rather, they appear in the list in the order in which they were created. If you’re an e-mail filtering ninja, however, you’re likely aware that the order in which filters are applied often matters.
Until now, the only solution I could come up with was to delete and re-create filters whenever I created a new filter that needed to be higher up in the list. But now there is a better way…
Changing the order of your Gmail filters
This isn’t a pretty solution, but it’s quite easy to implement. Start by going into Gmail Labs (Settings/Labs or click the little green beaker in the top right corner of the Gmail page) and enabling the “Filter import/export” functionality. Be sure to save your changes.

Now when you view your filters (Settings/Filters), there will be a checkbox off to the left of each filter. Simply do the following:
- Check the box for all of your filters (or click the “All” link at the bottom)
- Scroll down to the “Export” button (which is greyed out unless filter are selected)
- Click the button and you’ll be able to save a file called
mailFilters.xml
Now simply open up that file in your favorite text or xml editor and modify it to your heart’s content. The filters themselves are wrapped in “entry” tags, like this:
<entry>
blah blah blah (including category, title, id, updated, etc. fields)
</entry>
Just move those blocks around to change the order of the filters.
The last step is to re-import your filters.
- Delete your old filters by checking the box next to each and clicking the “Delete” button (next to “Export“)
- Click the “Import filters” link at the very bottom of the filters page
- Click the “Choose File” button, and select your modified
mailFilters.xmlfile - Click “Open file” and you’ll be presented with a list of filters to import
- Make sure all of the checkboxes are checked and then click “Create filters“
Note that this same procedure work for Google Apps.
{ 15 comments… read them below or add one }
Thanks for posting this! It’s kind of ridiculous that Google still hasn’t implemented a simple way to change the precedence of their filters, but this workaround is great.
Another alternative is to quickly send items to the bottom of the list by editing them and saving with no changes. That said — it appears that in my filters, they’re getting applied in reverse order. The first filter shown is the last processed.
Is that consistent with others experience as well?
Jammer, thanks for a great solution.
Jordan, I tried your edit/save and the saved one kept its place in the sequence.
I’m a huge advocate of Google apps, but some of the decisions they make around what gets priority and what gets fixed really boggles my mind. I need to control the order of Google filters and I don’t want to have to run through this many-step process just to control that. Please fix this Google!
Jammer, this is a terrific hack for an important missing feature. Thank you for the post!!!
This was a great tip. Thanks!
In which order are the filters applyed? From top to bottom, or from bottom to top?
Gmail filters are applied from top to bottom.
ty
I assume that Gmail filters are applied on any order, that more than one filters could hit the same email.
I specify in filter rules a full regular expression in match fields to avoid
any ambiguity, and now Gmail filters seem to work fine.
I will try to explain it better. I have an e-main gmail account that retrieves e-mails from other accounts, so i have setup a label for each account. So far so good. The problem starts when i want to filter specific e-mails to other labels.
For example, i want e-mails from:various@newsletters.com to:account2@gmail archived+moved to label:NEWSLETTERS, from:various@foruns.com to:account2@gmail archived+moved to label:FORUNS, etc, and the REMAINING e-mails to:account2@gmail.com archived+moved to label ACCOUNT2. If the last filter is applied first, all e-mails are archived+moved to label ACCOUNT2, and all other filters will not be applied… or will Gmail apply filters to archived mail, too? Because if it does, this will create a huge label messup… folders, anyone?
Worked a treat! I had 50 filters. Your process took less than 5 minutes start to finish.
Thanks for sharing this.
Try edit the filter, when you save, it goes to the end off the list !
Worked like a charm, thanks!
You can usually reach your goal by using negative matches.
Example: all mails matching subject “Reply” will go in label “Reply”, and all mail matching subject “-Reply” (does not contain the word reply) will go in label “Others”.