Aleksey Dorogov freelance software engineer
← All writing Python

How to Delete All Your Tweets on X (Twitter) — Free, Safe, Step by Step

Aug 2026 7 min read Aleksey Dorogov

There comes a moment for many of us when our tweet history has to go:

  • You’re starting fresh. Your old account is becoming your professional identity, but posts from years ago no longer represent who you are.
  • Your account was hacked. You got it back, but it’s full of spam posted by attackers.
  • You just want privacy. Ten years of thoughts don’t need to be searchable forever.

X has no “delete everything” button — and its official developer API now charges about one cent per deleted tweet. On a few thousand tweets, that adds up fast.

This guide shows you how to do it for free using a small Python tool. It walks you through setup with a friendly step-by-step wizard, then deletes everything slowly and safely. You can stop and continue at any time without losing progress.

What the tool actually does

When you delete a tweet by hand in the browser, your browser quietly sends a request to X saying “delete this one.” The tool does exactly the same thing — just many times in a row, at a careful human-like pace. To X, it looks like you clicking delete yourself.

It works in two stages:

  1. Scan — walks through your profile and saves a list of everything you’ve ever posted: tweets, replies, and reposts.
  2. Delete — goes through that list one by one, showing you progress as it goes.

Nothing is deleted until you explicitly choose it in the menu.

Read this before you start

  • Deletion is permanent. There is no undo button anywhere.
  • Want a backup first? Request your archive from X (Settings & privacy → Your account → Download an archive of your data). It arrives within about 24 hours and contains all your posts.
  • Keep your login secret safe. During setup the tool needs a special code from your browser session. Treat it like a password — never share it or post it anywhere.

If your account was hacked — start here

Clean up only makes sense if the attacker is gone. So before deleting anything:

  1. Change your password and turn on two-factor authentication (Settings → Security and account access).
  2. Log out of all sessions to kick them out completely.
  3. Log back in and follow this guide.

Deleting spam while an attacker still has access just means they’ll post it again tomorrow.

Step 1: Get the tool ready

You need Python installed on your computer (python.org/downloads). Then download the tool’s files into one folder and install its requirements by running:

pip install requests python-dotenv

That’s it for preparation. Everything else happens inside the tool itself.

Step 2: Run the setup wizard

In the tool’s folder, open a terminal (type cmd in the folder’s address bar in Windows Explorer) and start the program:

python main.py

The very first time, it will ask for access to your account. This takes about a minute — you’ll copy a couple of codes from your logged-in browser session:

  1. Open x.com in Chrome or Firefox and make sure you’re logged in.
  2. Press F12 on your keyboard. A panel will open.
  3. Click the Network tab, then click anywhere on the x.com page so some requests appear in the list.
  4. Click any request going to x.com, find Request Headers, and locate the line that starts with cookie:. Copy that entire long value.

Back in the tool, choose option 1 (“Paste the whole Cookie header”) and paste what you copied. The input stays hidden while you paste — these codes are your login.

Prefer entering values one by one? Choose option 2 instead and copy auth_token and ct0 from the Application (Chrome) or Storage (Firefox) tab → Cookies → https://x.com.

The wizard immediately checks the codes against X. You’ll see either a friendly confirmation like:

[ok] connected as @yourname

or a clear explanation of what went wrong. Once connected, the codes are saved locally, and you’ll never be asked again — future runs connect automatically.

Those codes give full access to your account. They stay in a local .env file on your computer and are never uploaded anywhere. Never paste them into websites, chats, or public repositories. If they ever leak, go to X settings and log out of all sessions — that invalidates them instantly.

Step 3: Scan your account

Now the main menu appears. Choose:

1. Scan my account

You’ll see it flip through page after page of your history. When it finishes, it prints a summary:

Done. 934 unique targets -> ids.json
  tweet    611
  reply    287
  retweet   36

Everything it found is saved to a file called ids.json — this is your deletion list.

Step 4: Check what it found

Choose 2. Preview deletions to see exactly what’s on the list — dates and text of each post, with nothing actually deleted.

This is your last chance to keep anything. Want to save a particular tweet? Open ids.json in any text editor and remove its entry before moving on.

If the count doesn’t match your profile, simply run the scan again — occasionally X pauses the process briefly; the tool tells you exactly when it will continue and picks up automatically.

Step 5: Delete

Delete in three comfortable stages, right from the same menu:

3. Delete a small test batch   → removes just 5 posts, for real
4. Delete EVERYTHING           → after typing DELETE as confirmation

So: run the test batch of five, check your profile on x.com to confirm they’re really gone, then choose the full wipe and type DELETE when asked.

Now it’s time to wait. The tool deletes roughly one item every 4–5 seconds on purpose — fast automated deleting looks suspicious to X and puts your account at risk. As a rule of thumb: about one hour per 1,000 posts. Most people just let it run overnight.

Stopping, resuming, and peace of mind

Life happens — laptops sleep, windows get closed. It’s all fine:

  • Progress is saved continuously. Whatever was already deleted never gets touched again.
  • Just rerun python main.py after any interruption and continue where you stopped.
  • Every action is logged to a file (audit.jsonl), so you always have a record of what happened and when.
  • Already-deleted posts are recognized. If something disappears between scan and delete, the tool notices and moves on instead of failing.
  • Rate-limit pauses show a timestamp. When X asks for a breather, the tool prints the exact local time it will resume and continues on its own.

Common problems and fixes

ProblemWhat to do
Error mentions 401 or 403 during connectionYour session codes expired — rerun python main.py, answer n when asked to reuse saved credentials, and paste fresh ones.
Occasional 403 mid-runUsually a brief throttle on X’s side; the tool retries automatically. If it keeps happening, wait ten minutes and rerun.
Error mentions 404X updated its website. Rerun — the tool fetches fresh addresses automatically.
Message like [rate-limit] hit - sleeping...Normal on large accounts. Note the printed resume time and let it run.
Scan found fewer posts than expectedRun the scan again; long histories are read in batches.

Questions people ask

Is this allowed? You’re deleting your own posts, just faster than by hand. It sits in a gray zone of X’s automation rules like every similar tool, which is why this one moves slowly and politely — that pace keeps risk minimal.

Can I bring tweets back afterwards? No. Deletion is final. That’s why the backup archive exists.

Does it work with private accounts? Yes — it acts as you, seeing exactly what you see.

Can I use it on someone else’s account? No. It can only delete posts from the account whose session codes you provide.

Do I need to edit configuration files? No. The wizard handles everything interactively. The saved .env file is created for you automatically.

The full source code is published alongside this post. Since it handles your account, please look through it before running — that’s exactly why it’s open.

Sitting on a version of this problem right now? I'd rather look at it than guess.

Email me