Want to access Gmail in an email program in addition to using the web interface? Find here the Gmail IMAP settings to set up synchronization of email and folders.

First, the Great Art of Light and Shadow

Peek with me, will you, through this tube. There, point it at the candle! What do you see?

You have just looked through a very early microscope, a lens mounted on one end of a tube with a flat sheet of glass mounted on the other as an object holder.

The object typically was an insect, and the whole apparatus first appeared in Athanasius Kircher’s wonderfully titled Ars magna lucis et umbraeThe Great Art of Light and Shadow.

Now, let’s hold a candle to the correct Gmail IMAP settings and allow email programs and services a peek at your mail and folders:

Copy and Paste These Gmail IMAP Settings to Access Your Email

To set up Gmail in an email program or service for synchronizing emails, folders and actions:

  1. Make sure IMAP is enabled in Gmail for your account.
  2. Use these Gmail IMAP settings in the email program or service:
NameValue
IMAP server
imap.gmail.com
IMAP port
993
Require TLS/SSL securityyes
User nameYour full Gmail address (e.g., [email protected])
PasswordYour Gmail password or an app password (with 2-step authentication enabled)

Gmail IMAP Settings: FAQ

Can I connect to Gmail IMAP using a different port such as “143”?

No.

Gmail requires a TLS/SSL connection to port 993. Trying to connect to the standard unencrypted IMAP port 143 will not work, even if the email program supports STARTTLS to add encryption to the connection.

My email program supports OAuth2; do I need to set up an app password?

No.

If you have authorized your email program or service for Gmail using OAuth2, you need not create a password for it to access your account, and it does not have to save a password on the computer.

OAuth2 is the currently most secure way to access Gmail in an email program.

Gmail IMAP Settings Explained

Gmail offers a host of slightly obscure settings that govern how email programs and services can connect to your account via IMAP.

You can find and configure the following Gmail IMAP Settings on the Forwarding and POP/IMAP tab inside Gmail options:

When I mark a message in IMAP as deleted:

When you delete an email using IMAP, it does not immediately disappear (or go to a “Trash” folder); instead, the program marks it with a “deleted” flag. Only when the email program finally sends the IMAP “expunge” command, all emails flagged as “deleted” are actually removed. Many email programs do this automatically when you switch folders, for example, or close the program.

With Gmail, this safety net is not normally necessary. Most email programs will copy messages to the Gmail “Trash” folder before marking them deleted. It is then save to expunge them.

  • Auto-Expunge on is the same as expunging every time a message is marked “deleted”. Gmail is always up to date. This is the recommended setting.
  • Auto-Expunge off means Gmail operates like a traditional IMAP account and honors the commands sent by email programs literally and wait for the “expunge” command to delete messages.

When a message is marked as deleted and expunged from the last visible IMAP folder:

This setting is available only when auto-expunge is disabled. It defines what happens to an email when is is removed from the last folder in which it appeared. With Gmail IMAP, every Gmail label corresponds to an IMAP folder, and every message appears in all the folders that correspond to its labels plus the “[Gmail]/All Mail” folder. All Gmail messages that are not deleted or spam show in the “All Mail” folder.

Not all Gmail folders need be visible to email programs via IMAP, though; you can turn off IMAP access to specific labels to make Gmail IMAP more lightweight and faster. Only the Inbox is always visible.

This setting only applies to folders available via IMAP.

  • Archive the message (default) means emails deleted from the last visible folder (including the Inbox) are still available in Gmail under All Mail (as well as all labels not accessible via IMAP).
  • Move the message to the Trash means emails deleted from the last visible folder are moved to the Gmail Trash label (corresponding to the “[Gmail]/Trash” folder. They will be automatically deleted forever after some 30 days in the Trash label; you can also empty the Gmail Trash manually, of course.
  • Immediately delete the message forever means emails deleted from the last visible folder are removed altogether. With this setting, Gmail works like a traditional IMAP account.
    If you do not see the message in the email program, it is gone beyond recovery. This is true even if the message was tagged with a label in Gmail that is not visible via Gmail IMAP.
    If you have Gmail IMAP enabled for the All Mail label, you cannot expunge an email from the “[Gmail]/All Mail” folder while it is still in another visible folder.

Folder Size Limit

Folder Size Limit lets you restrict the number of messages Gmail makes available via IMAP in each folder. IMAP folders can get large and unwieldy, and if your email program or mobile device insists on keeping a local copy of each message, they can take up a large amount of space—all for reading and working on last week’s emails.

With Limit IMAP folders to contain no more than this many messages, you can prevent overly large Gmail IMAP folders. All emails are always available in Gmail on the web and in the Gmail apps, of course.

(Copy and paste these Gmail IMAP settings to access your email tested with various email programs and services; updated January 2019)