Skip to content

Instantly share code, notes, and snippets.

@bracca95
Last active November 1, 2025 13:58
Show Gist options
  • Select an option

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

Select an option

Save bracca95/89504862d3c802f617794a2b8e42b94d to your computer and use it in GitHub Desktop.
delete-retweets-from-twitter.md

Ever wanted to delete all your retweets 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. Open the console and run the following JavaScript code:
/* define a function to delete retweets */
async function unRetweet() {
	const unretweetBtns = document.querySelectorAll('button[data-testid="unretweet"]')
	for (const btn of unretweetBtns) {
		btn.click();

		// wait a bit
		await new Promise(r => setTimeout(r, 150));
		document.querySelectorAll('div[data-testid="unretweetConfirm"]')[0].click();

		// again
		await new Promise(r => setTimeout(r, 150));
	}
	
	// scroll window by 500 lines
	window.scrollBy(0, 500);
}

/* call it every 2000 ms (can be changed) */
var myProc = setInterval(unRetweet, 2000)
  1. When the bottom is reached, type:
/* stop the process */
clearInterval(myProc)
  1. Don't forget to checkout how to remove likes and tweets!
@Vaibhav5757
Copy link

Thanks, it works like a charm.

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