How to delete all your Reddit comments with a simple console script.

Delete all your comments on Reddit.com with this console script that works in your browser window.

Jake Krajewski
3 min readDec 27, 2022

If you ever wanted to clean up your Reddit presence, and delete your account, your comments will be saved for eternity, but “disassociated” with your account. Here’s how you can get rid of them all quickly.

All it takes is a simple script that selects the delete button, and confirms yes. Here we do it in a forEach statement.

Procedure

  1. Log in to your account
  2. Preface reddit.com in the address bar with old like so:

3. Click on your “Comments” tab on Reddit so you can see the list of all your submitted comments.

4. Open your inspector pane (on any browser, right click anywhere on the page and select the option from from dropdown menu).

5. Click on the console tab, you should see this:

6. Enter this code for each page of comments you have down at the bottom where the console caret is located ( > ← this thing):

// Select all elements with the class "togglebutton" and the attribute "data-event-action" set to "delete"
var elements1 = document.querySelectorAll('a.togglebutton[data-event-action="delete"]');

// Loop through the elements and click on each one
elements1.forEach(function(element) {
element.click();
});

// Select all elements with the class "yes" and the attribute "onclick" containing "change_state"
var elements2 = document.querySelectorAll('a.yes[onclick*="change_state"]');

// Loop through the elements and click on each one, waiting one tick between each click
elements2.forEach(function(element, index) {
setTimeout(function() {
element.click();
}, index * 200); // 200 milliseconds per tick (THIS SHOULD BE TWEAKED)
});

It will look like this:

Your delay should not be 4ms as shown here, it is too fast to send many delete requests. Change it to something like 200 (you may have to experiment with the exact value that works for your browser. If you know what you’re doing, you can click on the Network tab to see all the delete requests being made).

7. When you press enter, it will select every link to delete, click it, then click on “yes” for are you sure (You may need to throttle it by adjusting the ms between each delete request, see note below)

8. Page through every one of your comment pages by clicking the next or previous button, and repeat from step 6. It will delete them all at once for every page. Voila!

Note: You may have to play with the delay of submitting each delete request. At 4 ms, it only looked like it was deleting everything instantly, but actually, it was only sending one delete request per run of the script. Slowing it down to 200 milliseconds per request helped it actually work for me, and you can experiment with the number that works for you!

Second Note: You may want to change the sorting option when viewing your comments, because sorting by new seems to only go back a year. I had to cycle through all the different sorts to see as many comments as possible.

Hope this helps, enjoy!

--

--

Jake Krajewski

☧ Cognitive Science Master, Experienced digital product designer. Formerly @GoPro . Exploring the intersection of tech, startups, and a.i./deep learning