Bulk delete all your tweets from Twitter/X using your archive data.
- Python 3.10+
- twikit library
pip install twikit- Go to Settings → Your Account → Download an archive of your data
- Request your archive and wait for Twitter to prepare it (can take 24-48 hours)
- Download and extract the archive
- Locate
data/tweets.jsinside the extracted folder
See what would be deleted without actually deleting:
python twitter_mass_delete.py path/to/tweets.js --dry-runpython twitter_mass_delete.py path/to/tweets.jsYou'll be prompted to type DELETE to confirm.
If the script stops (rate limit, network issue, etc.), resume where you left off:
python twitter_mass_delete.py path/to/tweets.js --resume| Option | Default | Description |
|---|---|---|
--cookies |
cookies.json |
Path to cookies file |
--delay |
1.5 |
Seconds between deletions |
--dry-run |
- | Preview without deleting |
--resume |
- | Resume from previous progress |
--progress-file |
delete_progress.json |
Path to progress file |
Run the script and enter your credentials when prompted:
--- Twitter Login ---
Username or email: your_username
Password: (hidden)
Do you have 2FA enabled? (y/n): n
If you have 2FA with an authenticator app, you'll need the TOTP secret (the setup key, not the 6-digit code).
If you get blocked by Cloudflare during login, use cookies from your browser instead.
- Log into x.com in your browser
- Open DevTools (F12)
- Go to Application tab → Cookies → https://x.com
- Copy the values for
auth_tokenandct0 - Create
cookies.json:
{
"auth_token": "your_auth_token_value",
"ct0": "your_ct0_value"
}- Run the script — it will use these cookies automatically
Twitter's bot protection is blocking the login request. Use the browser cookies method described above.
The script handles rate limits automatically by waiting 60 seconds and retrying. If you're getting rate limited frequently, increase the delay:
python twitter_mass_delete.py tweets.js --delay 3.0Make sure you're pointing to the correct tweets.js file from your Twitter archive, not a different file.
Delete cookies.json and re-authenticate (either via login or by exporting fresh cookies from your browser).
- Parses your Twitter archive (
tweets.js) to extract tweet IDs - Authenticates with Twitter using cookies or login credentials
- Deletes tweets one by one with rate limiting
- Saves progress periodically so you can resume if interrupted
MIT