Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Delete tweets before a date

If you're like me and you started Twitter when you were 14 in 2011, you're probably a different person now than you were back then. This script helps you clean up your Twitter/X timeline by deleting everything before a certain date — and keeping everything after it.

It is a browser DevTools console script. There is no app to install and no API key to set up. You paste it into the console on your own logged-in X profile, pick a cutoff date, and it deletes your posts older than that date.

How it works

The script runs in your browser using your existing X session. It only acts on your posts. Tweets on or after the cutoff date (local midnight) are kept. Anything older is deleted.

There are two modes:

  • Archive mode — pick data/tweets.js from an X data archive. This is the reliable way to reach old tweets.
  • Timeline mode — scrolls your profile page and deletes what is currently loaded. X only shows a limited number of recent posts this way, so old tweets often never appear. Use archive mode if your cutoff is years back.

How to use it

  1. Log in to x.com in your browser.
  2. Open your profile with replies: https://x.com/YOUR_USERNAME/with_replies
  3. Open DevTools → Console (Cmd+Option+J on Mac, F12 elsewhere). Chrome may ask you to type allow pasting the first time.
  4. Copy the entire contents of delete-before-date.js, paste it into the console, and press Enter.
  5. Enter a cutoff date as YYYY-MM-DD (for example 2018-01-01). Posts on or after that date are kept.
  6. Confirm, then choose a mode:
    • OK = Archive mode (select data/tweets.js from your unzipped archive)
    • Cancel = Timeline mode (only posts currently visible on the page)

Keep the tab open while it runs.

To stop early, type this in the console:

STOP_DELETE = true

Getting an archive (recommended)

  1. On X, go to Settings → Your account → Download an archive of your data.
  2. Wait until X says the archive is ready (this can take hours).
  3. Download and unzip it.
  4. When the script asks for a file, choose data/tweets.js.

Rate limits

X limits how many posts you can delete in a window. That limit is on their side and cannot be bypassed.

When the script hits a rate limit, it waits until X's reset time and then continues automatically. You may see a pause of several minutes. Leave the tab open and let it resume.

If you run this over a large archive, expect it to take a while.

Disclaimer

This is provided as-is, with no warranty. Use it at your own risk.

Deletions are permanent. You are responsible for the cutoff date you enter, for confirming the prompts, and for anything that happens to your account. The authors are not responsible for lost posts, account restrictions, rate-limit lockouts, X policy enforcement, or any other outcome.

This script is meant only for your own account. Do not use it on anyone else's.

About

Dev console script to delete your X/Twitter posts before a cutoff date.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages