Telegram Cache on Android devices

App Structure

This is the folder structure of the Android Telegram app.

App Cache

/storage
|-- sdcard0 or sdcard1 (depends on phone)
|   -- Telegram
|       -- Telegram Images
|       -- Telegram Documents
|       -- Telegram Audio
|       -- Telegram Video

Android Cache

/storage
|-- sdcard
|   -- android
|       -- data
|           -- org.telegram.messenger
|               -- cache

The cache folder is the Android cache folder for Telegram.

Manually Saved Images

/storage
|-- sdcard
|   -- Pictures
|       -- Telegram

This path is used when you open an image → “…” > Save to Gallery. A copy of the image is saved into this folder.

Cache Explanation

In /android/data/org.telegram.messenger/cache (aka the Android Cache) Telegram app keeps small avatars, media / file previews, temporary files, and Secret Chat media / documents.The app moves files (images, videos, voice messages, and 'files') which were received in Cloud Chats to Telegram/<Telegram sub folder>.

Why is it this way? The main reason for having Telegram Images, Videos, etc. folders is because users would like to save all incoming images to the gallery. Why not in the /android/data/org.telegram.messenger/cache folder? If media scan intent runs, there will be an album called Cache. Why no sub folder in /android/data/org.telegram.messenger/cache? If you clear the cache, you will get many non-working images in the gallery.

After moving the files - which is done automatically - it's no longer the “official Android cache”, so it's not cleared via Android Settings → Apps → Telegram → Clear Cache. If you delete the cache (Android Settings → Apps → Telegram → Clear Cache), cached profile images and even files from Secret Chats are deleted. In the Secret Chat, you have to manually download each file again from the Telegram Cloud.

Save to Gallery in Telegram Settings

Telegram for Android runs media scan intent, so the system knows what to do with the files. In other words, Android takes care of the files in its own database. Android knows when an image is or is not allowed to be displayed in the gallery.

Example:

  • You receive the images yes.jpg, no.jpg, and yes2.jpg.
  • You select Save to Gallery for yes.jpg and yes2.jpg.
  • In the Gallery, you will see yes.jpg and yes2.jpg.
  • The gallery will not display no.jpg.

File names

File names (datacenterId_localId.extension) in cache cannot be changed at the moment. If the file names are changed and the user relogs, Telegram would have to re-download all the files, since it would not know which name belongs to which file. If you save files (tap once next to the file in the chat and choose 'Save to Downloads', it will use the original file name.

Deleting Cache

Cloud Chats

If you delete the content in /Telegram/*, files will be re-downloaded again if you see an image or an audio message. This can be prevented by disabling auto-downloads in the Telegram settings. After disabling auto-downloads, you can manually remove files with a file explorer.

Go to Settings → Apps → Telegram → Clear Cache to delete the content of Android/data/org.telegram.messenger/cache.

Cached images from inline bots

If the content is already cached by the Telegram servers it will be stored in the Telegram folder, otherwise it's in the cache folder.

Secret Chats

If you delete the cache (Android Settings → Apps → Telegram → Clear Cache), cached profile images and even files from Secret Chats are deleted. In the Secret Chat, you need to manually download each file again from the cloud in case it wasn't purged from the server, yet.