Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
[Recipe] Delete all your likes/favorites from Twitter

Ever wanted to delete all your likes/favorites from Twitter but only found broken/expensive tools? You are in the right place.

  1. Go to:{username}/likes
  2. Open the console and run the following JavaScript code:
setInterval(() => {
  for (const d of document.querySelectorAll('div[data-testid="unlike"]')) {
  window.scrollTo(0, document.body.scrollHeight)
}, 1000)
Copy link

lionbytes commented Nov 13, 2022

setInterval(() => { for (const d of document.querySelectorAll('div[data-testid="unlike"]')) { } window.scrollTo(0, document.body.scrollHeight) }, 10000)
setInterval 5000 did not work on me. If you have more than 2000 likes, like me. Try 10000 for setInterval, it worked.
Anyway, thanks!

Working for me as of 12th Oct 2022. The only issue is that it starts throwing errors like api/graphql after some time. I take 5 mins break and restart it and it works great. There is rate limit of 900 requests every 15 minutes.

Is there any code similarly for deleting tweets&repllies ??

I modified the code a while ago. It worked for me, you just need to run it and go do something while it deletes the tweets:

Copy link

Works on Chrome! Thanks!

Copy link

chriiisclm commented Nov 18, 2022

nice still works on chrome, tab should be open tho.

Copy link

How can I limit this code to a time period or a username? I don't want all likes to be removed and only want to remove the likes of a particular account

Copy link

dafunks commented Nov 28, 2022

Just so you all know, if you use GreaseMonkey you can easily do this with a script: and it works really well.

Copy link

bpawel-bclub commented Dec 15, 2022

Would anyone please share the latest snippet? (15 Dec 2022 doesn't seem to be deleting likes...) - Thank you!
EDIT (18/12/22): The script might actually be working: it removes the "hearts" but the liked tweets still stay in place, so I was a bit confused.

Copy link

I have 13 likes on my account that i can't get rid of. I also can't see them. I assume these likes are from suspended twitter accounts. But i don't know for sure. I tried running the code but it didn't change anything. Any idea how to get rid of those invisible likes?

Copy link

FYI for anyone who happens across this gist, there is a limit of 1000 likes / unlikes per day and older liked tweets don't show up as "liked" on your timeline, so you need to like and unlike them to actually remove them.
I am using semiphemeral to remove the likes and retweets.
As per

Copy link

bobmagicii commented Dec 30, 2022

the OG post is still working for me on the 30th of dec 2022. doing it in batches of 900 due to the rate limit.

i think a lot of people seeing it not work are seeing cache. the current iteration of their site uses stupid amounts of local cache in addition to server side stuff. a hard refresh (shift+refresh) usually clears it. also deleting my tweets with another script, my counter still says 41 even though there are 1. and yesterday it still said 83. so that was more of their server side cache i think and maybe a week from now it'll be a different lower number.

also i think if you posted in "communities" those count as posts but are not searchable by anything on their system. i was semi active in the php community and there seems to be no way to even manually find those posts to hand delete.

if you're rooting around the dev console to use this you can kinda see how absolutely bad their app is. cors violations for days lmao.

another final note if you do hit the api rate limit, and hit it too hard, the rest of the ui will take a dump. if you hit the like delete rate limit and refresh there is a chance it will say you still have 300 likes, but "you dont have any likes yet" for a while, because the api just so angry. that only happened once so far though. it can also happen if you've blocked accounts. you'll have to unblock and unmute them.

Copy link

7jmoran commented Jan 5, 2023

Screen Shot 2023-01-04 at 10 55 00 PM


I hope those who see this are having a great week. I used the script to mass delete likes, and it was working well until it broke. I guess I did it too quickly and reached the limit. If anyone, absolutely anyone, can help me figure out how to fix this so that my likes will reappear so that I can continue deleting likes (carefully this time), I will be eternally grateful. Please. I am desperate. I am afraid that I have ruined Twitter forever. As you can see, it says that I have not liked anything yet, but I have over 5K likes.

Thank you!

Copy link

i have the same problem, the no. of tweets is 300 but it says on the likes tab You don’t have any likes yet

Copy link

bobmagicii commented Jan 8, 2023

every weekend i have to go back to twitter and more likes are there. its almost like it takes their system forever to dig them out of super old archive. and if i unlike like 20 of them, while still staring at more and refresh all of them will vanish. until next weekend again. im down to 291 now.

you just have to keep on keeping on.

Copy link

ShitaraRimule commented Jan 18, 2023

by favorite, you mean bookmarks yes or no ? thats can be usefull for myself if yes.

Copy link

It's hard to say what the deal is with Twitter right now. Since the takeover it seems increasingly unstable. A lot of non-core things are apparently silently broken

Copy link

thankyou sir :) worked your all script ,

Copy link

Thanks for sharing this.
It removed 5k likes, but now i'm stuck at 4k? It appears around 2018 is when the above script stopped working.

It's been 36 hours and stuck

Copy link

RodLeyton commented Feb 2, 2023

Working very well. Thank you, glad I searched first!
Takes a while, set interval a lot longer to stop twitters rate limiter.
Even 10sec still hit the rate limiter, but this was a new account so only had 10k likes.
Take note of the "[HTTP/2 429 Too Many Requests 208ms]".
If you want to run it overnight, may need to add delay per click instead.
Thank you very much

Copy link

Is there a way to the same with Retweets?

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