Tutorial Twitter

Unblock all blocked Twitter accounts at once

If you have blocked hundreds of accounts, unblocking them one by one takes a lot of time. But there is a quick and easy way to unblock them all at once. You don’t need to give any app write permissions to your account for it to work.

Short version:
Got to the blocked accounts setting page, scroll to the bottom and run
in the browser console.

Long version:

1. Go to the settings

On this page you see all accounts your are blocking at the moment:

2. Open the Developer Tools

Quickest way: Press F12 on Windows/Linux or Command+Option+I on MacOS. Tested on Chrome and Firefox.
You can go through the menu as well. Firefox: Extras -> Web Developers. Chrome: Other Tools -> Developer Tools.

You should now see a new area in your browser. Either on the right side or on the bottom of the window.

3. Open the Browser Console

Either by pressing “Esc” or selecting it in the top menu of the developer tools. With the console you can execute any JavaScript commands.

4. Scroll to the bottom of the page

The command we will use to unblock all accounts only unblocks accounts, that are loaded on the page. Therefore we need to scroll to the bottom so Twitter loads all accounts. You can do that manually by holding the scroll bar to the bottom or you can use the following two commands.

Start automated scrolling:
var autoScroll = setInterval(() => window.scrollTo(0, document.body.scrollHeight),1000);
‘setIntervall’ executes the function we give it every 1000 milliseconds. windows.scrollTo scrolls to the end of the page. If the page got longer the next time (after 1 second) the command is executed, it will scroll further.
Stop automated scrolling:
Once we reached the bottom, we want to stop the scrolling.

5. Unblock all accounts

Now that all accounts are loaded, we can unblock them ad once by executing the following code. Only execute this once!

Explanation of the code:
$ refers to jQuery. A JavaScript library we can access because Twitter uses it and therefore it’s available on the page.
('.user-actions-follow-button') selects all Elements with the class “user-actions-follow-button”. While the class refers to following, Twitter uses it for the unblock button as well. You can see this yourself, when you use the element selector. The class stays the same after unblocking and the buttons change into follow buttons. If you would run the command again, it would follow all accounts.
.click() clicks on all elements that were selected.

If you leave the .click(), you can see how many accounts it would unfollow. You can add .length instead to get a cleaner output. In my case it would be 3 accounts.


If you have an questions feel free to leave a comment or ask me on Twitter.

Update 12.07.2019: NewTwitter

The Twitter web interface got a new design. NewTwitter is written in React and it unloads elements while scrolling. Therefore the code snippet from above doesn’t work anymore. Instead of scrolling to the bottom and unblocking every account at once you need to scroll just a bit, unblock all visible accounts, scroll again, unblock and so on.

1. Go to new blocked accounts setting

There is a new URL for the blocked accounts. The old one will forward to the new one, for now: https://mobile.twitter.com/settings/blocked/all (‘mobile’ is only necessary if you haven’t fully switched to the new interface.)

2. Execute autoUnblock-snippet in the browser console

The following code sets up an interval which fires every second (1000 milliseconds). After each second it scrolls down one page, selects all unblockable accounts and clicks the unblock button.

let autoUnblock = setInterval(function() {
    document.querySelectorAll('[aria-label="Blocked"]').forEach(function(account) {
}, 1000);

3. Stop the autoUnblocker once it’s done

Once all accounts are unblocked, you can stop it by executing the following code in the browser console. Alternatively, just close the browser tab.


Optional one-time reversal of the process

With the new code you can’t accidentally follow the once blocked accounts anymore. That’s great. Additionally it is possible to block them again. But only while the browser tab is open. Once the tab is closed, the list of accounts is gone.

Execute the following snippet to block all the accounts you just unblocked. The only change is from ‘Blocked’ to ‘Block’ in the aria-label.

let autoBlock = setInterval(function() {
    document.querySelectorAll('[aria-label="Block"]').forEach(function(account) {
}, 1000);

This code needs to be stopped as well.


Unmute all muted accounts

Some people asked me how to umute all accounts they ever muted. With the new code snippet that’s easy as well.

Go to the settings page with the muted accounts: https://mobile.twitter.com/settings/muted/all

let autoUnmute = setInterval(function() {
    document.querySelectorAll('[aria-label^="Unmute"]').forEach(function(account) {
}, 1000);

Once all accounts are unmuted, stop it:


To reverse it (only while possible while you haven’t left the page), change the name from ‘autoUnmute’ to ‘autoMute’ (or anything else) and replace ‘[aria-label^=”Unmute”] with ‘[aria-label^=”Mute”]’.

Technical explanation: The ‘ ^ ‘ is necessary because the aria-labels for Muting/Unmuting contain the account name. ‘ ^ ‘ says, that the aria-label starts with the phrase, but it can contain other stuff. For the blocked accounts that isn’t necessary because they all have the same aria-label.

7 Comments Add New Comment

Leave a Reply

Your email address will not be published. Required fields are marked *