Web Applications Stack Exchange is a question and answer site for power users of web applications. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use labels extensively in my Gmail inbox. Is there any way to sort by label? Seems like that could be quite useful.

share|improve this question
Gmail only sorts by date descending. – Al E. Jul 6 '12 at 17:21

Impossible via the Web UI, and difficult with IMAP (coding).

gmail imap layout

Label are considered like folder on the first level of the IMAP (blured on the picture).

Messages can have several labels, some don't have any.

Sorting Email per label would required to browse the "All Mail" to create a list of all the emails, browse every single label folder to obtain the list of emails. And then process the data to sort per label. And all that via IMAP.

I'm not even thinking about how to sort emails with several labels.

It's too much effort for a poor result.

share|improve this answer
The web UI is where I'd like to do it; I'm not using IMAP. I can search by label ("Label:label-name") so I guess what I need is a way to search by all labels, then do an "order by" kind of thing. – user249493 Jul 6 '12 at 16:37
@user249493 the web UI sits on top of the Folder design illustrated on the answer. ("Label:label-name") means search in the folder "label-name". The same emails will be included in All mail but without any mention to the label "label-name". Label simply don't exist at the IMAP level. – baptme Jul 6 '12 at 17:06
@user249493 plus there's no operator for sorting email in any order support.google.com/mail/bin/answer.py?hl=en&answer=7190 – baptme Jul 6 '12 at 17:07
+1 for "I'm not even thinking about how to sort emails with several labels. It's too much effort for a poor result." – mhoran_psprep Jul 6 '12 at 17:08
@mhoran_psprep thanks, I really think it's possible because I'am doing things very similar with (PHP / PHP IMAP / MySQL to cache) but it's more a stackoverflow topic. – baptme Jul 6 '12 at 17:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.