- Go to your profile on instagram.com (sign in if not already)
- Click on XXX following for the popup with the users you're following to appear
- Open Chrome Devtools and Paste the code into the Console tab and hit return
Last active
November 25, 2025 19:19
-
-
Save stan-voo/eb16b24507242a1bae7def7dc6465589 to your computer and use it in GitHub Desktop.
Instagram Mass Unfollow Google Chrome Console Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Wrap the entire function in parentheses to make it an IIFE (Immediately Invoked Function Expression) | |
| (async function () { | |
| const MAX_PER_DAY = 400; // Maximum number of unfollows allowed per day | |
| const PAUSE_AFTER_BATCH = 10; // Pause after every 10 unfollows | |
| const PAUSE_DURATION = 10 * 60 * 1000; // Pause duration: 10 minutes (in ms) | |
| // Helper function: Creates a promise that resolves after ms milliseconds | |
| const delay = (ms) => new Promise(r => setTimeout(r, ms)); | |
| // Helper function: Returns random integer between min and max (inclusive) | |
| const randomDelay = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min; | |
| // Helper function: Finds button element by its text content | |
| const findButton = (txt) => [...document.querySelectorAll("button")].find(btn => btn.innerText === txt); | |
| // Use localStorage to track today's date and unfollow count | |
| const today = new Date().toISOString().split("T")[0]; // format: YYYY-MM-DD | |
| const key = `unfollowed_${today}`; | |
| const alreadyUnfollowed = parseInt(localStorage.getItem(key) || "0"); | |
| // If daily limit reached, stop immediately | |
| if (alreadyUnfollowed >= MAX_PER_DAY) { | |
| console.log(`π Daily limit of ${MAX_PER_DAY} unfollows already reached.`); | |
| return; | |
| } | |
| // Global flag to allow manual stopping via console: window.STOP_UNFOLLOW = true | |
| window.STOP_UNFOLLOW = false; | |
| let unfollowed = alreadyUnfollowed; | |
| console.log(`π Start unfollow session (${unfollowed}/${MAX_PER_DAY} already unfollowed today)`); | |
| // Main loop: continues until MAX_PER_DAY is reached or no more Following buttons exist | |
| for (let i = 0; unfollowed < MAX_PER_DAY; i++) { | |
| // Check if user manually stopped the process | |
| if (window.STOP_UNFOLLOW) { | |
| console.log("π Unfollow process manually stopped."); | |
| break; | |
| } | |
| // Find next "Following" button on the page | |
| const nextButton = findButton("Following"); | |
| if (!nextButton) { | |
| console.log("β No more 'Following' buttons found."); | |
| break; | |
| } | |
| // 20% chance to "change mind" and skip unfollow (human-like randomness) | |
| if (Math.random() < 0.2) { | |
| console.log("π€ Skipped this one (random 'changed mind')"); | |
| window.scrollBy(0, 100); | |
| await delay(randomDelay(1000, 2000)); | |
| continue; | |
| } | |
| // Scroll button into view and click it | |
| nextButton.scrollIntoViewIfNeeded(); | |
| nextButton.click(); | |
| await delay(300); // Wait for dialog to appear | |
| // Find and click the confirmation "Unfollow" button in the dialog | |
| const confirmButton = findButton("Unfollow"); | |
| if (confirmButton) { | |
| confirmButton.click(); | |
| unfollowed++; | |
| localStorage.setItem(key, unfollowed); // Save progress in localStorage | |
| console.log(`β Unfollowed #${unfollowed} today`); | |
| } else { | |
| console.log("β οΈ Confirm button not found"); | |
| } | |
| // Simulate human scrolling behavior | |
| window.scrollBy(0, randomDelay(50, 150)); | |
| // Wait random time between 5-20 seconds before next action | |
| const waitTime = randomDelay(5000, 20000); | |
| console.log(`β³ Waiting ${Math.floor(waitTime / 1000)} seconds...`); | |
| await delay(waitTime); | |
| // After every batch, take a longer break to avoid detection | |
| if (unfollowed % PAUSE_AFTER_BATCH === 0 && unfollowed !== 0) { | |
| console.log(`π΄ Pausing for ${PAUSE_DURATION / 60000} minutes after ${unfollowed} unfollows`); | |
| await delay(PAUSE_DURATION); | |
| } | |
| } | |
| console.log(`π Finished session. Total unfollowed today: ${unfollowed}`); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment