This script automatically unfriends all your Facebook friends from the Friends List.
It clicks each “Friends” button ➜ selects Unfriend ➜ confirms it ➜ scrolls ➜ and repeats until your list’s empty.
- Go to: https://www.facebook.com/{YOUR_USERNAME}/friends
- Scroll a bit so Facebook loads more friends.
- Open your browser console:
- Windows:
Ctrl + Shift + J - Mac:
Cmd + Option + J
- Windows:
- Paste the script below into the console.
- Press Enter and let it handle the rest ⚡
You can just chill while it does the unfriending one-by-one — it even auto-confirms the popup.
// 👋 This script automatically unfriends all your friends on Facebook.
// Just open https://facebook.com/{YOUR_USERNAME}/friends, scroll a bit to load your friends,
// then paste this code into your browser console and press Enter.
async function smartUnfriendLoop() {
// lil helper so we can wait between actions
const delay = (ms) => new Promise((res) => setTimeout(res, ms));
// keep track of processed friends
let processed = new Set();
while (true) {
// find all "Friends" buttons
const buttons = [...document.querySelectorAll('div[aria-label="Friends"]')]
.filter((btn) => !processed.has(btn));
// if none found, scroll and wait
if (buttons.length === 0) {
window.scrollBy(0, 1000);
await delay(1500);
// check if we’re really done
if (document.querySelectorAll('div[aria-label="Friends"]').length === 0) {
console.log("✅ All done! Looks like you’ve unfriended everyone.");
break;
}
continue;
}
// loop through visible friends
for (const btn of buttons) {
processed.add(btn);
btn.scrollIntoView({ block: "center" });
await delay(300);
// open the dropdown
btn.click();
await delay(500);
// find “Unfriend” in the menu
const unfriend = Array.from(document.querySelectorAll('[role="menuitem"]'))
.find((e) => e.innerText.includes("Unfriend"));
if (unfriend) {
unfriend.click();
await delay(500);
// confirm the popup if it appears
const confirm = Array.from(document.querySelectorAll('[aria-label="Confirm"]'))
.find((e) => e.innerText.includes("Confirm"));
if (confirm) {
confirm.click();
console.log(`👋 Unfriended (${processed.size})`);
}
}
await delay(800); // slight pause before next friend
}
}
}
// 🚀 Run it!
smartUnfriendLoop();