Skip to content

How to Delete Multiple Instagram Posts in Bulk Automatically?

Learn how to mass delete Instagram posts automatically without any app, software, or extensions. A simple script to automate the bulk deletion of posts.

Update: Hello, there have been a few changes in Instagram UI, hence this script won’t be working now. I need to adjust the script, however, there is no ETA for when I will do it. Thank you for understanding.

If you’re revamping your business, then it’s a good idea to remove all the existing posts and start from scratch. However, Instagram does not support mass delete options. You need to delete the photos one after the other manually only from the mobile app.

Currently, the Instagram mass delete or clean-up solutions available are very limited and unsecured. The Instagram mass cleanup third-party apps require you to share your login username and password. These apps are not even listed on Google PlayStore or Apple App Store, hence you can imagine the risk to your account.

I recently published an article and video demo on how to delete Instagram photos on the computer. Though this option is not available, however using the tip, I mentioned you will be able to delete the post from a computer browser.

Based on the same tip, I developed an InstaG Purger script that automatically deletes Instagram photos fast from your account one after the other. This script is safe and does not need your credentials, unlike other solutions.

If you want to take a rest and assign bulk delete Instagram work to someone, you can hire me like my recent client has done to get 15000+ posts deleted.

How to Bulk Remove Instagram Photos?

As I mentioned, the mass deletion or bulk removal of Instagram photos is really simple using the script. It only works on the computer and not on mobile phones.

Here are the steps to mass delete Instagram posts at once:

Step 1: Log in to your Instagram account in the Chrome browser on the computer.

Step 2: Switch to the Profile home page. ex: https://instagram.com/restorebin

Step 3: Right-click for more options and select Inspect.

Chrome Browser Inspect Element option

Step 4: Click on the Toggle device toolbar.

Device toolbar Chrome

Step 5Reload the Instagram profile page.

Step 6: Click on the Feed icon to make a switch.

Instagram Feeds icon

Step 7: Switch to the Console tab in the Developer console.

Step 8: Copy and paste the below InstaG Purger script in the Console.

Instagram Purger Script in Developer Console

Step 9: Hit on the Enter button on the keyboard to execute the script and auto-delete the Instagram photos.

Instagram posts delete on computer browser

The script will be executed, and the console log will display the number of posts deleted. You can customize the script to set as many as the post you want to delete.

Number of Instagram Photos using script

There are chances that the script might fail after a few days or months due to changes in Instagram UI. However, please let me know if it does, I will be happy to update and fix the script as soon as possible.

The InstaG Purger script can mass delete all Instagram posts at once without any software, apps, or extensions.

InstaG Purger Script

Here is the script that you need to run in the Chrome browser developer console:

// Name: InstaG Purger
// Details: https://wpaq.com/instagram-posts-bulk-delete/

var i = 0;                                                                                              //  set your counter to 0
function instagramDeleter() {                                                                           //  create a deleter loop function
   setTimeout(function () {                                                                             //  call a 3s setTimeout when the loop is called
        document.querySelector('div.Igw0E.rBNOH.YBx95._4EzTm').click();  //  selector to click on options menu
        setTimeout(function () { document.querySelector('button.aOOlW.-Cab_').click(); }, 2000)         //  selector to click delete option
        setTimeout(function () { document.querySelector('button.aOOlW.-Cab_').click(); }, 4000)         //  selector to click delete confirmation
        console.log (i+1 +" Deleted")                                                                   //  delete numbering to console
        i++;                                                                                            //  increment the counter
        if (i < 5) {                                                                                    //  if the counter < 5, call the loop function
            instagramDeleter();                                                                         //  ..  again which will trigger another 
        }                                                                                               //  ..  setTimeout()
    }, 6000)
}
instagramDeleter();

Modify the highlighted value in green to set the number of Instagram posts to be deleted in one go.

Alternatively, you can also use this variation of the script below that will run in some cases.

var i = 0; 
function instagramDeleter() { 
  setTimeout(function () { 
    document.querySelector('div.QBdPU').click();
    setTimeout(function () { document.querySelector('button.aOOlW.-Cab_').click(); }, 2000) 
    setTimeout(function () { document.querySelector('button.aOOlW.-Cab_').click(); }, 4000) 
    console.log (i+1 +" Deleted") 
    i++; 
    if (i < 5) { 
     instagramDeleter(); 
    } 
  }, 6000)
}
instagramDeleter();

Thanks to Dan for altering the script and mention in the below comment sections.

Limitation for InstaG Purger

Though the InstaG Purger script eases your job of bulk or mass deleting the Instagram account. There are some limitations while the script is running. Most importantly, you should leave the tab open and let the script do its work in the background.

  • The script may fail if Instagram revamps the website UI.
  • You may not be able to use Instagram in the same tab while the script is running.
  • The script removes posts sequentially from the latest to the oldest order, you may not be able to change the sequence.
  • You will need a fast data connection for Instagram feeds to load quickly.
  • If you refresh or reload the page, the script will stop, and you may need to re-execute the script again.
  • The deleted post count won’t be refreshed in real-time.

If you’re facing any issue apart from the mentioned, please drop in below comment box.

Limitation of Instagram Delete API

These are the few limitations of Instagram API when you run the script and delete the post in bulk.

  1. Instagram API allows only 1000 actions per day. In our case, only 1000 delete post action.
  2. API limit deleting 100 posts per hour.

If you violate these limits, you will encounter error code 429 in the browser console. In such a case, wait for 24 hours to get the daily limit reset.

Please be mindful of following this limitation as it might temporarily suspend the delete activity if misused. Frequent violations might also lead to account suspension permanently.

Alternatively, you can hire me to delete your IG post in bulk.

Video on Mass Delete Instagram Photos

Here is the video demo on mass deleting Instagram photos from desktop browsers using the InstaG Purger script.

How to Mass Delete Multiple Instagram Posts in Bulk?

I hope you liked the video; please subscribe to our channel on YouTube.

Kushal Azza

Kushal Azza

Kushal Azza is a Google Certified IT Professional, Digital Content Creator, and Go-To Digital Marketer. He has over a decade of experience solving tech problems, troubleshooting, and creating digital solutions. Follow him on Twitter and LinkedIn.

91 thoughts on “How to Delete Multiple Instagram Posts in Bulk Automatically?”

  1. Hi ! I am trying to follow your guide for the mass/bulk delete posts on IG but i get an error

    Uncaught TypeError: Cannot read property ‘click’ of null
    at :4:94

    Can you please help me with this ?

    regards!
    Daniel

    1. Hi Daniel, looks like the IG has revamped the website elements. However, I’ve updated the script and tested live. It working now!

      Thank you for the alert.

      Cheers!
      Kushal

  2. Hi awesome tool! It kind of executes the command, however I get a 400 (bad request) error. Please advise 🙂

    Much appreciated!

    1. Hello Xander, I just ran the script. It running without any issues. Not sure how you are facing the issue.

      Is your network connection fast enough? Also, have you switched to the responsive mode by click on the Device toolbar?

      Please follow the video carefully. //Kushal

  3. HI Kushal,

    I am trying to follow the guide but getting the error

    Uncaught TypeError: Cannot read property ‘click’ of null
    at :9:78

    Can you please help?

    Thanks,
    Amy

    1. Hi Amy, I just executed the script and was able to delete a couple of posts without any error.

      Please do check the limitation section in the above post. Make sure that you are following DONT’s.

      Often time when we interrupt the script, we get such error. However, let me know if you still encounter it.

      Cheers! //Kushal

      1. Yes after I paste the Script and hit Enter I get an error
        “Uncaught syntax error: unexpected indetifier”

    1. Hi Rene, I am not sure why it isn’t working at your end. It’s perfectly fine in my system.

      Do you have any extensions that can typically block the ‘click’ action? Please try once in Chrome incognito mode.

      Also, make sure to run the script with the ‘device toolbar’ toggle enabled mentioned in step #4.

  4. I am also cant use this way. . .

    Uncaught TypeError: Cannot read property ‘click’ of null at :5:78
    Uncaught TypeError: Cannot read property ‘click’ of null at :6:78

  5. Hey Hi, For me this script was not working without any ad blocker extensions. Kindly give a best solution for the below error message

    Uncaught TypeError: Cannot read property ‘click’ of null
    at :5:78

    1. The issue is mostly due to a slow network connection speed that unable to load the button element to ‘click’. Try raising the timeout limit. Replace 2000 with 5000, 4000 with 8000, and 6000 to 10000 milliseconds. This will make the execution slower but with a high success rate.

      Let me know how it goes. Thanks!

        1. Try increasing the timeout to even higher milliseconds value. Also, run the script in incognito mode without any extensions being active.

    2. i tried your script.but it deletes only i pictures. I tried it on 5 as well as on 10 but same issue arirses as it deletes only one picture

    3. hi!! Is there a way to change this code to delete the *oldest* pics. For example, I don’t mind my new pics (2020), but want to delete the old ones (2015). Please let me know!

      1. Hi Courtney, unfortunately, Instagram does not allow us to sort the post from oldest to newest. Hence, it’s isn’t possible to older posts first and then run the script.

    4. VM104:9 Uncaught TypeError: Cannot read property ‘click’ of null
      at :9:78
      (anonymous) @ VM104:9
      setTimeout (async)
      (anonymous) @ VM104:9
      setTimeout (async)
      instagramDeleter @ VM104:7
      (anonymous) @ VM104:18

      thats the error im seeing please help out.. i want to delete over 5000 posts

      1. Hello Tara, I don’t see any issue with the script. It’s running fine at my end. Please read the limitations sections before you proceed.

    5. Hi… i try ur script it work for 12 post deleted.. but it stop after 12… and showing error
      Uncaught TypeError: Cannot read property ‘click’ of null
      thanks for ur hardwork

      1. ohh nvm… i found the problem ald.. it because it only load 12 post when i click on feed… so i scroll down until it load all picture first then i start the script.. work like a charm… thank you for the script.. ^^

        1. Well, it looks like mine is working. I opened a post to start the script. Waiting to see if its actually deleting. Will be sooo glad

      1. The script is unable to find the element to perform ‘Click’ action, make sure you’re following the steps and also read the limitations.

    6. The code does not work at all on my insta. The error message is Uncaught SyntaxError: Unexpected end of input
      6(index):1 Unchecked runtime.lastError: The message port closed before a response was received.
      Please help

      1. Hello Ntokozo, I don’t see any error. I was able to run the script and delete few test posts. Please read through limitations and follow the steps carefully.

    7. Hi, the script only works if I press the options button. Otherwise, the script does not work automatically unless I click the options button on my own. Help?

    8. Hello I am getting “Uncaught TypeError: Cannot read property ‘click’ of null
      at :5:78
      (anonymous) @ VM125:5
      setTimeout (async)
      (anonymous) @ VM125:5
      setTimeout (async)
      instagramDeleter @ VM125:3
      (anonymous) @ VM125:10
      setTimeout (async)
      instagramDeleter @ VM125:3
      (anonymous) @ VM125:10
      setTimeout (async)
      instagramDeleter @ VM125:3
      (anonymous) @ VM125:14” and the same kind of message after each delete but nothing is being deleted.
      I tried this in incognito as well. Thank you, help?

      1. Hi Amalia, the script is running fine. I don’t see any issues. It’s might be something to do with your browser, or perhaps the IG is testing out new UI. However, will keep an eye on this.

      1. Hi Aman, that’s probably an issue with Instagram feeds loading due to slow internet or browser caching. What you can do is scroll down to the extreme bottom of your Instagram timeline and run the script. There won’t be any loading issue and the script will delete the feeds smoothly.

    9. Hey, this is the error I am getting after running the script.

      undefined
      VM280:7 1 Deleted
      VM280:5 Uncaught TypeError: Cannot read property ‘click’ of null
      at :5:78
      (anonymous) @ VM280:5
      setTimeout (async)
      (anonymous) @ VM280:5
      setTimeout (async)
      instagramDeleter @ VM280:3
      (anonymous) @ VM280:14
      VM280:6 Uncaught TypeError: Cannot read property ‘click’ of null
      at :6:78

    10. Hi , i have update the code to :

      var i = 0; // set your counter to 0
      function instagramDeleter() { // create a deleter loop function
      setTimeout(function () { // call a 3s setTimeout when the loop is called
      document.querySelector(‘button.wpO6b’).click(); // selector to click on options menu
      setTimeout(function () { document.querySelector(‘button.aOOlW.-Cab_’).click(); }, 2000) // selector to click delete option
      setTimeout(function () { document.querySelector(‘button.aOOlW.-Cab_’).click(); }, 4000) // selector to click delete confirmation
      console.log (i+1 +” Deleted”) // delete numbering to console
      i++; // increment the counter
      if (i < 5) { // if the counter < 5, call the loop function
      instagramDeleter(); // .. again which will trigger another
      } // .. setTimeout()
      }, 6000)
      }
      instagramDeleter();

      and it work perfectly, thanks for ur function bro !!

    11. Hey! How do I chose photos I want to be deleted? I want to delete about 600 posts from my very first post up to 600. I do not want to delete my new posts. If thats even option. Thanks!

      1. Technically, that’s not possible with the script. However, you can archive the recent post that you want to preserve, and after running the script and clearing the unwanted, just unarchive.

    12. I dont know whats wrong. Ive tried ths severally in different ways. It shows deleted and the script runs but when i refresh, the posts are still there.

    13. I noticed a slight issue. I may be able to fix it myself. I just wanted to let you know. I somewhat got the 2nd block of code to work. There’s an issue when it come to looping back after deleting the first post.

      Instagram was automatically switching back to grid view which then messed up the loop containing to delete the 2nd post. After adjusting the last timeout line of code to more seconds…I found that if I manually clicked the top to bottom view on the IG page it would continue to loop properly. I’m not sure how to add this to the code yet. but I’ll try. Let’s get this working! Thanks for the fun task and awesome code so far.

    14. Hello there and appreciate this tool.

      Started deleting yesterday and was seeing these errors -https://snipboard.io/mvewUZ.jpg as the script is still running as I have not closed the tab.

      Is it suppose to happen like this?
      When the script works successfully, what is it supposed to look like?

      Using a fresh incognito tab, I tried to load the profile to see, if by any chance the posts count may have reduced, posts deleted, no change. I know the delete post count won’t be refreshed in real-time as suggested.

      How long before we see post counts are refreshed and posts are successfully deleted, hours, a day, days or more?

      Any advice, many thanks!

    15. LOL, so that link doesn’t and the tab running the script has automatically reloaded. So the error is similar to this:
      undefined
      VM280:7 1 Deleted
      VM280:5 Uncaught TypeError: Cannot read property ‘click’ of null
      at :5:78
      (anonymous) @ VM280:5
      setTimeout (async)
      (anonymous) @ VM280:5
      setTimeout (async)
      instagramDeleter @ VM280:3
      (anonymous) @ VM280:14
      VM280:6 Uncaught TypeError: Cannot read property ‘click’ of null

      In our reply to Sandeep you said Looks like the script is unable to identify the click element, what are you referring to, novices here, so please elaborate 🙂

      1. Hello, there have been few changes in Instagram UI, hence this script won’t be working now. I need to adjust the script, however, there is no ETA when I will do it. Thank you for understanding.

    16. Hello, I updated the code to:

      var i = 0;
      function instagramDeleter() {
      setTimeout(function () {
      document.querySelector(“div._9AhH0”).click();
      setTimeout(function () {
      document.querySelector(“div.MEAGs > button.wpO6b”).click();
      }, 1000);
      setTimeout(function () {
      document.querySelector(“button.aOOlW.-Cab_”).click();
      }, 2000);
      setTimeout(function () {
      document.querySelector(“button.aOOlW.-Cab_”).click();
      }, 3000);
      console.log(i + 1 + ” Deleted”);
      i++;
      if (i < 200) {
      instagramDeleter();
      }
      }, 6000);
      }
      instagramDeleter();

      and got it working again. Hope it helps others.

    17. Hey, I made a fix. this one works as of January 2022.

      const timeout = (ms) => {
      return new Promise((resolve) => setTimeout(resolve, ms));
      };

      const deleteAllInstaPosts = async (articleClassName) => {
      const posts = document.querySelectorAll(`article.${articleClassName} a`);
      for (const post of posts) {
      post.click();
      await timeout(2000);

      const menuButton = document.querySelector(“div.MEAGs button.wpO6b “);
      menuButton.click();
      await timeout(2000);

      const deleteButton = document.getElementsByClassName(“aOOlW -Cab_ “)[0];
      deleteButton.click();
      await timeout(2000);

      const deleteButton2 = document.getElementsByClassName(“aOOlW -Cab_ “)[0];
      deleteButton2.click();
      await timeout(2000);

      await timeout(2500);
      }
      };

      deleteAllInstaPosts(“ySN3v”);

    18. Hi, can you post the full code to be used as January 2022?
      I’m confused by the late fixes.
      Something we can copy+paste.
      Thank you!

    19. Hi all, I’ve made adjustments to the script so it doesn’t rely on the Device/Feed display anymore. This is broken because it will always revert to the main page. This addition to the script will fix that. Just run it from your main page even no need to toggle Device mode.

      var i = 0;
      function instagramDeleter() {
      setTimeout(function () {
      document.querySelector(‘div.KL4Bh’).click();
      setTimeout(function () { document.querySelector(‘div.Igw0E.rBNOH.YBx95._4EzTm’).click(); }, 1000)
      setTimeout(function () { document.querySelector(‘button.aOOlW.-Cab_’).click(); }, 2000)
      setTimeout(function () { document.querySelector(‘button.aOOlW.-Cab_’).click(); }, 4000)
      console.log (i+1 +” Deleted”)
      i++;
      if (i < 5) {
      instagramDeleter();
      }
      }, 6000)
      }
      instagramDeleter();

    20. my 50 cents…

      var i = 0;
      document.querySelector(‘svg[aria-label=”Feed”]’).parentNode.click();

      function instagramDeleter() {
      setTimeout(function() {
      document.querySelector(‘svg[aria-label=”More Options”]’).parentNode.click();

      setTimeout(function() {
      document.evaluate(‘//button[text()=”Delete”]’, document, null, XPathResult.ANY_TYPE, null).iterateNext().click()
      setTimeout(function() {
      document.evaluate(‘//button[text()=”Delete”]’, document, null, XPathResult.ANY_TYPE, null).iterateNext().click()
      console.log(i + 1 + ‘ Deleted’)
      i++;
      setTimeout(function() {
      document.querySelector(‘svg[aria-label=”Feed”]’).parentNode.click();
      instagramDeleter();
      }, 2000);
      }, 2000);
      }, 1000);
      }, 1000);
      }
      instagramDeleter();

    Leave a Reply

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