Skip to content

Instantly share code, notes, and snippets.

@bracca95
Last active November 5, 2025 16:11
Show Gist options
  • Select an option

  • Save bracca95/ea06bfa6c38316566f7a14a0efcd5939 to your computer and use it in GitHub Desktop.

Select an option

Save bracca95/ea06bfa6c38316566f7a14a0efcd5939 to your computer and use it in GitHub Desktop.
delete-tweets.md

Ever wanted to delete all your tweets from X (Twitter) but only found broken/expensive tools? You are in the right place.

  1. Go to: https://x.com/{username}/with_replies
  2. Modify the strings marked as "EDIT"
  3. Open the console and run the following JavaScript code:
var nameToFind = "YOUR TWITTER NAME"; // EDIT
var deleteStr = "Delete"; // EDIT: USE YOUR OWN BROWSER LANGUAGE HERE

/* define a function to delete tweets */
async function unTweet() {
  const tweets = Array.from(document.querySelectorAll('article[data-testid="tweet"]'))
    .filter(article => article.textContent.includes(nameToFind));

  for (const tweet of tweets) {
    // click the horizontal caret in each tweet
    tweet.querySelector('button[data-testid="caret"]').click();
    await new Promise(r => setTimeout(r, 500));

    // find delete option
    const menuItems = document.querySelectorAll('div[data-testid="Dropdown"] div[role="menuitem"]');
    const deleteBtn = Array.from(menuItems).find(el => el.textContent.includes(deleteStr));
    
    // if exists
    if (deleteBtn) {
    	deleteBtn.click()
    	await new Promise(r => setTimeout(r, 500));
    
    	// confirm deletion
	    const confirmBtn = document.querySelector('button[data-testid="confirmationSheetConfirm"]');
	    confirmBtn?.click();
	    await new Promise(r => setTimeout(r, 1000));
    }
  }

  // scroll page
  window.scrollBy(0, 500);
  await new Promise(r => setTimeout(r, 500));
}

/* call it every 5000 ms (can be changed) */
var myProc = setInterval(unTweet, 5000)
  1. When the bottom is reached, type:
/* stop the process */
clearInterval(myProc)

Don't forget to checkout how to remove likes and retweets!

@bracca95
Copy link
Author

bracca95 commented Nov 1, 2025

Update: November, 1st (2025)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment