Kiến Thức Chung

Sort Gmail by Subject, Size, Labels and Sender

One feature I often miss in Gmail is its ability to sort messages. By default, Gmail sorts email by date, which doesn’t do a great job in organizing your inbox. There is no facility to sort emails by name, subject, size, and sender. Consider this scenario where sorting of emails can be very useful: You were on vacation and on returning you find hundreds of unread emails, and now you want to see only the unread messages by your boss between the specific dates.

One thing to note that Gmail is based on search and not sort, therefore things have to be done here in different ways. Let us look how you can sort Gmail messages:

Sort Gmail by Size

use size operator for Gmail search

As organize by size cannot be done directly in Gmail, you can use Outlook or Thunderbird (email clients) to import your emails and then sort them by size (Importing Instructions). Though there is no way you can sort Gmail by the size of emails, you can however use the search operator “size:” to find large size mails. You can also use “smaller:” or “larger:” operators sort mails with lesser or greater than specified size.

You can also search for “filetype:zip” or “filetype:pdf” or any files that you regularly receive to find the large size mails.

Bonus tip: For those, whose inbox memory is full you can search for “has:attachment from:me label:sent” which will list mails sent by you and have a attachment. You can safely delete them to get some extra space.

Sort Gmail by Sender

There are two techniques to achieve sorting, use any one of the them depending on what suites you.

1. You can use the below script to sort active view by sender. For browser’s other than Chrome, just copy-paste below code to the address bar. For Chrome, go to Developer Tools by pressing F12 key, then select the console tab and then paste this code. Hit enter key and your mails will be sorted by sender. Note that only the current view will get sorted, so it is better to select maximum mails shown per page from Gmail settings.

!function(){function e(e){var t,n,a,r,l=e.getElementsByTagName("td");for(a=0;a<l.length;a++){if("yX xY "==l[a].className)for(t=l[a].getElementsByTagName("div"),r=0;r<t.length;r++)if("yW"==t[r].className&&(n=t[r].getElementsByTagName("span"),n.length))return n[0].innerHTML;if(l[a].hasAttribute("role")&&"link"==l[a].getAttribute("role"))for(t=l[a].getElementsByTagName("div"),r=0;r<t.length;r++)if("y6"==t[r].className&&(n=t[r].getElementsByTagName("span"),n.length))return n[0].innerHTML}return""}function t(e,t){return e=e[0].toLowerCase(),t=t[0].toLowerCase(),t>e?-1:e>t?1:0}function n(n){var"tr"),0);if(a.length){for(var r=a[0].parentNode,l=[],g=0;g<a.length;g++)l[g]=[e(a[g]),a[g]];for(l=l.sort(t),g=0;g<l.length;g++)r.appendChild(l[g][1])}}for(var a=document.getElementsByTagName("table"),r=0;r<a.length;r++)if("F cf zt"==a[r].className){n(a[r]);break}}();

2. The second method is a simple implementation of search concept. Hover over any name/contact’s image and select Emails from the contact card to view all incoming(received) or outgoing(sent) mails with selected name. To view only received mails, search with from:sender’s name in Gmail inbox. Find the complete tutorial here.

Xem thêm :  Ngỡ ngàng với cách làm bánh sầu riêng chiên giòn ngon đáo để

Sort Gmail by Subject

To sort your mails by subject, we will use a custom code to arrange the current set of emails that you are viewing.

Xem thêm:   Windows 10 1809’s new rollout: Mapped drives broken, AMD issues, Trend Micro clash

If you are using any browser other than Chrome, then simply copy paste the below code to address bar and press Enter Key. For Chrome, first press the F12 key to enter Developer Tools and then click on Console tab. Now paste the below code and press enter. This code will only sort the current set of mails that you are viewing.

!function(){function e(e){var t,a,n,r,l=e.getElementsByTagName("td");for(n=0;n<l.length;n++){if("xY a4W"==l[n].className)for(t=l[n].getElementsByTagName("div"),r=0;r<t.length;r++)if("y6"==t[r].className&&(a=t[r].getElementsByTagName("span"),a.length))return a[0].innerHTML;if(l[n].hasAttribute("role")&&"link"==l[n].getAttribute("role"))for(t=l[n].getElementsByTagName("div"),r=0;r<t.length;r++)if("y6"==t[r].className&&(a=t[r].getElementsByTagName("span"),a.length))return a[0].innerHTML}return""}function t(e,t){return e=e[0].toLowerCase(),t=t[0].toLowerCase(),t>e?-1:e>t?1:0}function a(a){var"tr"),0);if(n.length){for(var r=n[0].parentNode,l=[],g=0;g<n.length;g++)l[g]=[e(n[g]),n[g]];for(l=l.sort(t),g=0;g<l.length;g++)r.appendChild(l[g][1])}}for(var n=document.getElementsByTagName("table"),r=0;r<n.length;r++)if("F cf zt"==n[r].className){a(n[r]);break}}();

Sort Gmail by Labels

In Gmail, you can drag-and-drop a label, which makes labeling quite easy. You can also select which labels to show and which one to hide from Gmail’s Settings page. However, unlike outlook that arranges folders automatically there is no such sorting facility in Gmail.

This greasemonkey script lets you sort labels as you last used them. Example: From the set of labels X,Y and Z suppose you recently used Y. So, the labels will be sorted by Y,X and Z.
You can download this script here and you must have greasemonkey firefox addon or Chrome’s tampermonkey extension to use it.

Gmail by default sort mails by date. To find mails between specific dates in Gmail, you will have to do an advance search. Click on the arrow inside Gmail search box and then choose “Date within” search criteria. There is no field for “From” and “To” date to search however entering only one date and then selecting date within range will give same results.

specify the dates to be same

Sort Read and Unread Mails

This one is easy. Just hover over Inbox link and click on the drop arrow. Select “Unread First” and your unread mails will be listed first and then the read emails.

click drop down and select unread

You can also search all unread mail by entering “is:unread” in the Gmail search box. Similarly, enter “is:read” to search for all read mails.

Sort Incoming Mails with Filters

You probably know that, you can use Gmail id with a plus (+) to create a new version of your account. Suppose your email id is [email protected] Now, even if you subscribe any website with [email protected] , then also all the mails will come to you only. You can create as many versions you want by appending any word with your username with plus (+) symbol.
Now the trick is to use Filters and Multiple Inboxes with this feature to sort different types of incoming mails.

Xem thêm:   Galaxy S6 and S6 Edge Preview: iPhone-Beating Designs

Xem thêm :  Download Snagit for Windows 10 Free (2021)

Go to Gmail Settings > Filters > Create New. In the “To” field, specify your alias id with plus sign and then chose a label for it. Now go to Labs under Gmail settings and enable Multiple Inboxes. After saving you can see Multiple Inboxes tab within settings. For the different panes, use the labels that we have configured with filters. That’s all, you will now have different panes in Inbox based on different labels or senders.


We have tried to find workarounds for different types of sorting in Gmail. If you have any difficulty in implementing these workarounds, feel free to contact us. We need to understand that Gmail is different from the traditional mail clients like outlook or yahoo. It’s a very powerful application, only if you can learn to search and make proper filters. Here are some of the search operators that you will find useful in daily life.


Used to specify the sender
Example – from:amy
Meaning – Messages from Amy

Used to specify a recipient
Example – to:david

Meaning – All messages that were sent to David (by you or someone else)

Search for words in the subject line
Example – subject:dinner

Meaning – Messages that have
the word “dinner” in the subject

Search for messages matching term A or term B*
*OR must be in all
Example – from:amy OR from:david
Meaning – Messages from Amy or from David

Used to exclude messages from your search
Example – dinner -movie
Meaning – Messages that contain the word “dinner” but do not contain
the word “movie”

for messages by label*
*There isn’t a search operator for unlabeled messages
Example – from:amy label:friends
Meaning – Messages from Amy that
have the label “friends”Example – from:david label:my-familyMeaning – Messages from David that
have the label “My Family”

Search for
messages with an attachment
Example –

from:david has:attachment
Meaning – Messages from David that have
an attachment

Search for messages on mailing lists
Example – list:[email protected]

Meaning – Messages with the words [email protected] in the headers, sent to or from this list


Xem thêm :  Thành ngữ chứa từ gọi tên động vật trong tiếng việt

Search for an attachment by name or type
Example –

Meaning – Messages with an
attachment named “physicshomework.txt”

Example –
label:work filename:pdf

Meaning – Messages labeled
“work” that also have a PDF file as an attachment

” ”
Used to search for an exact phrase*
*Capitalization isn’t taken into consideration
Example –
“i’m feeling lucky”

Meaning – Messages containing
the phrase “i’m feeling lucky” or “I’m feeling lucky”Example –
subject:”dinner and a movie”

Meaning – Messages containing
the phrase “dinner and a movie” in the subject

( )
Used to group words
Used to specify terms that shouldn’t be excluded
Example –
from:amy(dinner OR movie)

Meaning – Messages from Amy
that contain either the word “dinner” or the word “movie”Example –
subject:(dinner movie)

Meaning – Messages in which
the subject contains both the word “dinner” and the word “movie”

Search for messages anywhere in Gmail*
*Messages in Spam and Trash are excluded from searches
by default
Example – in:anywhere

Meaning – Messages in All Mail,
Spam, and Trash that contain the word “movie”

Search for messages in Inbox, Trash, or Spam
Example – in:trash

Meaning – Messages from Amy that
are in Trash

Search for messages that are starred, unread or read
Example –
is:read is:starred from:David
Meaning – Messages from David that
have been read and are marked with a star

Used to specify recipients in the cc: or bcc: fields*

*Search on bcc: cannot retrieve messages on which you were blind carbon copied

Example –

Meaning – Messages that were cc-ed to David



Search for messages sent
during a certain period of time*
*Dates must be in yyyy/mm/dd format.
Example –
after:2004/04/16 before:2004/04/18
Meaning – Messages sent between April 16, 2004 and April 18, 2004.*
*More precisely: Messages sent after 12:00 AM (or 00:00) April 16, 2004 and before April 18, 2004.

Search for chat messages
Example –

is:chat monkey
Meaning – Any chat message including the word “monkey”.

Search for messages within a particular email address in the Delivered-To line of the message header
Example –
deliveredto:[email protected]

Meaning – Any message with [email protected] in the Delivered-To: field of the message header (which can help you find messages forwarded from another account or ones sent to an alias).

[From Google support]

Related : Best Gadgets for Gmail

Was this post helpful?

Let us know if you liked the post. That’s the only way we can improve.

Xem thêm bài viết thuộc chuyên mục: Tips – IT and Computing

Xem thêm bài viết thuộc chuyên mục: Kiến Thức Chung

Related Articles

Back to top button