An automatic script to unfollow everyone on Twitter/X quickly and efficiently.
- β Fully automatic - Automatically confirms each unfollow
- β‘ Ultra fast - Up to 300 unfollows per minute
- π‘οΈ Safe - Smart pauses to avoid rate limiting
- π Real-time counter - See your progress as it works
- π Auto-continues - Searches for more accounts if needed
- π« Easy to stop - Just refresh the page
- Log in to Twitter/X
- Go to your profile
- Click on "Following"
- Chrome/Edge:
F12orCtrl+Shift+I - Firefox:
F12orCtrl+Shift+K - Safari:
Cmd+Opt+I
- Go to "Console" tab
- Copy and paste the complete script
- Press
Enter - Sit back and relax! πΏ
// Script to automatically unfollow on Twitter/X
var count = 0;
function nextUnfollow() {
return document.querySelector('[data-testid*="unfollow"]');
}
function nextUnfollowConfirm() {
return document.querySelector('[data-testid="confirmationSheetConfirm"]');
}
function wait(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function removeAll() {
let unfollowButton = nextUnfollow();
while (unfollowButton) {
try {
// Click on the unfollow button
unfollowButton.focus();
unfollowButton.click();
console.log(`Clicking unfollow button for account ${count + 1}...`);
// Wait for the confirmation dialog to appear
await wait(200);
// Find and click the confirmation button
let confirmButton = nextUnfollowConfirm();
let attempts = 0;
// Try to find the confirmation button up to 5 times
while (!confirmButton && attempts < 5) {
await wait(100);
confirmButton = nextUnfollowConfirm();
attempts++;
}
if (confirmButton) {
confirmButton.focus();
confirmButton.click();
count++;
console.log(`β
Unfollowed account ${count}`);
} else {
console.log("β Could not find confirmation button, skipping...");
}
// Longer pause every 100 unfollows to avoid rate limiting
if (count % 100 === 0) {
console.log(`βΈοΈ Taking a longer break after ${count} unfollows (10 seconds)...`);
await wait(10000);
} else {
await wait(100); // Pausa de 2 segundos entre cada unfollow
}
} catch (error) {
console.error("Error during unfollow process:", error);
await wait(3000);
}
// Find the next unfollow button
unfollowButton = nextUnfollow();
}
// Check if there are more accounts to unfollow
check();
}
function check() {
const remainingUnfollowButtons = document.querySelector('[data-testid*="unfollow"]');
if (!remainingUnfollowButtons) {
console.log(`π Finished! Total unfollowed accounts: ${count}`);
console.log("No more accounts to unfollow found.");
} else {
console.log("π Found more accounts to unfollow, continuing...");
// Esperar un poco antes de continuar
setTimeout(() => {
removeAll();
}, 500);
}
}
// Start the process
console.log("π Starting Twitter/X unfollow automation...");
console.log("β οΈ Make sure you're on your 'Following' page");
console.log("βΉοΈ To stop the script at any time, refresh the page");
removeAll();Change these values in the script:
// Wait for the confirmation dialog to appear (line ~26)
await wait(1000); // Instead of 200
// Longer pause every 100 unfollows to avoid rate limiting (line ~49)
if (count % 10 === 0) { // Instead of 100// Wait for the confirmation dialog to appear (line ~26)
await wait(100); // Instead of 200
// Longer pause every 100 unfollows to avoid rate limiting (line ~49)
if (count % 1000 === 0) { // Instead of 100- π Make sure you're on the right page (Following)
- π±οΈ Don't click anything while the script is running
- π± Keep the tab active (don't minimize it)
- βΉοΈ To stop: simply refresh the page
- π If it stops: refresh and run again
Yes, it only automates clicks you would do manually. It doesn't modify Twitter's code.
Very unlikely. The script uses pauses to mimic human behavior.
No, only on desktop browsers with developer console.
Simply refresh the page and run the script again. It will continue from where it left off.
It's better to let it finish first to avoid interference.
| Problem | Solution |
|---|---|
| "Can't find buttons" | Make sure you're on the Following page |
| "Stops by itself" | Refresh the page and run again |
| "Too slow" | Use aggressive configuration |
| "Console error" | Refresh and try again |
- β‘ Ultra fast (300ms between unfollows)
- π Better button detection
- π Improved counter
- β Basic working version
- π Slower (2s between unfollows)
Found a bug or want to improve the script?
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If this script saved you time, give the repo a star! β
Disclaimer: This script is for educational purposes only. Use at your own risk. I am not responsible for any issues with your Twitter/X account.