Original repo:


Copyright 2016 Fabian Schlenz
Licensed under GPLv3


This is a small Java app that allows you to download all your history from Telegram's servers and keep a local copy of them.


You can find the whole app packed into one fat jar file under releases.


  • You can use multiple accounts with this tool.
  • Messages are saved in a SQLite database; media (documents, photos, videos, stickers, geolocations, audios) are downloaded and saved as files.
  • A GUI is planned for later; at the moment this is a command line tool only.
  • Incremental backups - if you run the tool at a later time, it will only download new messages / media.


This tool relies on Telegram's API. They started rate limiting the calls made by this tool some time ago. As of February 2017, downloading messages is limited to 400 messages every 30 seconds, resulting in 48,000 messages per hour. Media download is not throttled right now, so it should be a lot quicker.

But since this tool is designed to be able to continue it's work at any time, you can just abort the download and continue it later - that way, you'll be moving step by step towards a complete archive of your telegram messages and media files.


You need to have at least Java 1.7 installed on your machine. Download the jar file, and run it on the console like this: java -jar telegram_backup.jar.

Append --help to get a list of all available commands.

Basically, you have to call it with --login first to login to your telegram account and then call it again with --account <phone> to use this account and download all it's history. If you have just one account, you can omit this parameter.

Use --with-supergroups and / or --with-channels to also download all messages from the supergroups / channels you have joined that have been active in the last time.

After making a backup, call it again with --export html to create a few more-or-less nice to look at HTML files containing all your chats. They will be created in the subfolder files of your backup. You can just open the file index.html in your browser to look at the files.


I've put quite some time into this tool. If you want to donate a small amount, you can send it via Bitcoin to 1CofYzS88iEngxMu4NqQeohWDBUHv9CNDJ or via PayPal to

Alternatively use this link the next time you shop at or this link for You won't pay any more, but I will get a few percent of your purchase's worth from amazon.


If you have questions or comments or need help, you can join the telegram_backup Development group at Telegram.

Frequently asked questions

Why do I see error messages?

The library I'm using to access Telegram has some small bugs. One of those is the display of meaningless (because they are being acted accordingly upon) error messages. Those include:

  • Exception in thread "pool-x-thread-y" java.lang.Error: java.nio.channels.ClosedChannelException
  • Something containing AUTH_ERROR You can just ignore these messages.

Basically, if the tool is continuing to run after error messages are shown, you can just ignore the messages. Either way, even if Telegram_Backup would "miss" some files or messages, this will be detected at the next run of this program and then tried again.

Where do you save the files?

The files are being saved in your User directory in a folder named telegram_backup. Under windows, this would typically be under C:\Users\<username>\telegram_backup. Linux users should look unter /home/<username>/.telegram_backup.

You can change this directory by supplying --target <dir> when calling Telegram_Backup.

What are those files and folders?

In the folder telegram_backup is one folder named stickers, which will hold all sticker images you've received. Then there is a folder for each account, named after the phone number associated with that account.

In these folders you will find auth.dat and dc.dat, which contain authentication data. There is database.sqlite which is a SQLite3 database containing all your messages and other data. The folder files contains all media files, named after the ID of the message they belong to. Last but not least the folder export contains exported data.

What are EmptyMessages? Why are there so many messages?

If you are a member of a normal group (non-supergroup), all messages sent to that group are being copied to your personal messages at Telegram's servers.

If you later leave this group, those messages are being deleted at Telegram, but since all messages are continuously numbered, you can't simply delete them because that would leave a hole in your message numbers. So these messages are instead replaced by EmptyMessages - those things contain zero information, they are just saying "here was a message but it was deleted".


This tool uses libraries from other developers which are covered by other licenses, which are:

  • Kotlogram by Yannick Badoual, licensed under MIT License.
  • SQLite JDBC by Taro L. Saito, licensed under Apache License version 2.0.
  • by RightTime, Inc., licensed under Apache License version 2.0.
  • Logback by, licensed unter LGPL version 2.1.
  • SLF4J by, licensed under MIT license.
# Download:

# Refs:

223a0fdde39a3fe75533fc2ae615e66c5e13ab0d refs/heads/master 223a0fdde39a3fe75533fc2ae615e66c5e13ab0d refs/remotes/origin/HEAD 223a0fdde39a3fe75533fc2ae615e66c5e13ab0d refs/remotes/origin/master 30618b4e3e4b3c1bb94befb2487b9d40bda5b85b refs/tags/1.0.1 2cb1d717b3d55c4b84bb55efaf19f29eb1a6eb0d refs/tags/1.0.2 2bee99518b2efd6904e8b6903eef78ae10b768d4 refs/tags/1.0.3 d24693dd70b825c37d0bec7135cd03f1fa6e940f refs/tags/1.0.4 9704645274ed734885686fd6fe2c20001bdf6d54 refs/tags/1.0.4-pre.1 be47080983b766fe10c48fc1ffff00e5e71eb64d refs/tags/1.0.4-pre.2 61b2a1e178667c2257818d7f9ba39663f9b71079 refs/tags/1.0.4-pre.3 3b528162f46fb88f2332bddc67e097b3f912b4cf refs/tags/1.0.4-pre.4 fa864f37b78cebf77097a5b00d8cb86ee3f9542b refs/tags/1.0.5 ef89185439902dbdf8db396bb81380e8f103e24a refs/tags/1.0.5-test.1 2ccb0cea9f52a621a7e04481881382ec9a67e79d refs/tags/1.0.5-test.2 45adc77d5e502fca4057126b7c655cf94137f08f refs/tags/1.0.5-test.3 89073d128aaf9e74986aed789fea242b0c3c1bb0 refs/tags/1.0.5-test.4 3415d493fff76e523c82b4d4c9c8eccef7b226f7 refs/tags/1.0.5-test.5 8670e9e24e8a151e99b166a09cffd43592574c9c refs/tags/1.0.6 e6dac48172d7c0acecf9d7265dc58150d996a103 refs/tags/1.1.0 5db388081c917b15dabb8b3db5e62405ec8a8ab2 refs/tags/1.1.1 f967f20fe6511ea7d1368ceafade5de92a6c76a0 refs/tags/1.1.2 d51929e37bd01ea1dfa90629429487b14374fe87 refs/tags/1.1.3 cfe6bd6725249a0f1f4c51d8a05df29c09a35d39 refs/tags/1.1.4