Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Unfollow all on Facebook

Facebook: Unfollow people and pages

  1. Open news feed preferences on your Facebook menu (browser)
  2. Click people or pages
  3. Scroll down (or click see more) until your full list is loaded
  4. Run the script in your browser console

Facebook will block this feature for you while you use it, depending on how much entities you try to unfollow. It automatically unblocks in a couple of hours and you will be able to continue.

See comments section for more up-to-date versions of the script

var unfollowButtons = document.querySelectorAll('[data-followed="1"]'); for(var i=0;i<unfollowButtons.length;i++){ unfollowButtons[i].click(); } alert(unfollowButtons.length+' people are now unfollowed! ');
@bdoner

This comment has been minimized.

Copy link

@bdoner bdoner commented Jul 7, 2017

Update 07-07-2017:

  1. --||--
  2. Click unfollow people to hide their posts.
  3. --||--
  4. Run below script in your browser console.
    var buds = document.querySelectorAll("[data-testid=\"unfollow\"] [data-testid=\"profile_grid_block\"] div[role=\"button\"]"); for(var b of buds){ b.click(); }
@reuniware

This comment has been minimized.

Copy link

@reuniware reuniware commented Jun 11, 2018

Great ! Thanks

@paulchrisluke

This comment has been minimized.

Copy link

@paulchrisluke paulchrisluke commented Aug 18, 2018

been using this for months, really grateful thank you!

@PokeYouInDaEye

This comment has been minimized.

Copy link

@PokeYouInDaEye PokeYouInDaEye commented Sep 4, 2018

Thank you!
Is there a way to reverse the code too? To re-follow everyone?

@aspirez4

This comment has been minimized.

Copy link

@aspirez4 aspirez4 commented Sep 30, 2019

Working as of 30 Sep 2019. Also there is timeout so facebook won't block unfollowing.
var unfollowButtons = document.querySelectorAll('div[data-testid=profile_grid_block_picture]'); unfollowed = 0; for(var i=0;i<unfollowButtons.length;i++) { setTimeout(function(element){ element.click(); unfollowed ++; console.log('Total unfollowed ' + unfollowed + ' out of ' + unfollowButtons.length) }, i*2000, unfollowButtons[i]) }

@doronbehar

This comment has been minimized.

Copy link

@doronbehar doronbehar commented Oct 22, 2019

Thanks @aspirez4! Worked for me.

@sastone75

This comment has been minimized.

Copy link

@sastone75 sastone75 commented Jan 21, 2020

It worked for me, unfollowed 861 pages.

@davr

This comment has been minimized.

Copy link

@davr davr commented Mar 27, 2020

Updated, worked 3/27/2020 for me

  1. arrow in upper right
  2. news feed preferences
  3. unfollow people
  4. paste this script into devtools console, come back later (it clicks one button every 2 seconds to prevent being blocked by FB, decrease the 2000 value if you want)

var unfollowButtons = document.querySelectorAll('div[aria-pressed="false"]'); unfollowed = 0; for(var i=0;i<unfollowButtons.length;i++) { setTimeout(function(element){ element.click(); unfollowed ++; console.log('Total unfollowed ' + unfollowed + ' out of ' + unfollowButtons.length) }, i*2000, unfollowButtons[i]) }

@HasnatCET

This comment has been minimized.

Copy link

@HasnatCET HasnatCET commented Apr 14, 2020

Updated, worked 3/27/2020 for me

  1. arrow in upper right
  2. news feed preferences
  3. unfollow people
  4. paste this script into devtools console, come back later (it clicks one button every 2 seconds to prevent being blocked by FB, decrease the 2000 value if you want)

var unfollowButtons = document.querySelectorAll('div[aria-pressed="false"]'); unfollowed = 0; for(var i=0;i<unfollowButtons.length;i++) { setTimeout(function(element){ element.click(); unfollowed ++; console.log('Total unfollowed ' + unfollowed + ' out of ' + unfollowButtons.length) }, i*2000, unfollowButtons[i]) }

TnQ so much

@gelsoniezzi

This comment has been minimized.

Copy link

@gelsoniezzi gelsoniezzi commented Apr 18, 2020

Updated, worked 3/27/2020 for me

  1. arrow in upper right
  2. news feed preferences
  3. unfollow people
  4. paste this script into devtools console, come back later (it clicks one button every 2 seconds to prevent being blocked by FB, decrease the 2000 value if you want)

var unfollowButtons = document.querySelectorAll('div[aria-pressed="false"]'); unfollowed = 0; for(var i=0;i<unfollowButtons.length;i++) { setTimeout(function(element){ element.click(); unfollowed ++; console.log('Total unfollowed ' + unfollowed + ' out of ' + unfollowButtons.length) }, i*2000, unfollowButtons[i]) }

Tkx, dear

@mehmetegemen

This comment has been minimized.

Copy link

@mehmetegemen mehmetegemen commented May 4, 2020

Probably your Facebook language should be English to use below.
Here is my solution as the 4th of May, 2020:

const follows = document.querySelectorAll('div[aria-label="Toggle to follow"]')
for (let i = 0; i<follows.length; i++) {
  setTimeout(() => follows[i].click(), i * 1500)
}
@alvin-chang

This comment has been minimized.

Copy link

@alvin-chang alvin-chang commented Jul 7, 2020

Updated, worked 3/27/2020 for me

  1. arrow in upper right
  2. news feed preferences
  3. unfollow people
  4. paste this script into devtools console, come back later (it clicks one button every 2 seconds to prevent being blocked by FB, decrease the 2000 value if you want)

var unfollowButtons = document.querySelectorAll('div[aria-pressed="false"]'); unfollowed = 0; for(var i=0;i<unfollowButtons.length;i++) { setTimeout(function(element){ element.click(); unfollowed ++; console.log('Total unfollowed ' + unfollowed + ' out of ' + unfollowButtons.length) }, i*2000, unfollowButtons[i]) }

Working on 7/7/2020.

@StarvingEmma

This comment has been minimized.

Copy link

@StarvingEmma StarvingEmma commented Jul 18, 2020

Probably your Facebook language should be English to use below.
Here is my solution as the 4th of May, 2020:

const follows = document.querySelectorAll('div[aria-label="Toggle to follow"]')
for (let i = 0; i<follows.length; i++) {
  setTimeout(() => follows[i].click(), i * 1500)
}

Tried every code on here, only yours worked on 18th of July 2020 for new facebook look. I wish I'd know how to make things like this. Thank you so so much.

@Tazmanian-legs

This comment has been minimized.

Copy link

@Tazmanian-legs Tazmanian-legs commented Jul 26, 2020

Probably your Facebook language should be English to use below.
Here is my solution as the 4th of May, 2020:

const follows = document.querySelectorAll('div[aria-label="Toggle to follow"]')
for (let i = 0; i<follows.length; i++) {
  setTimeout(() => follows[i].click(), i * 1500)
}

Tried every code on here, only yours worked on 18th of July 2020 for new facebook look. I wish I'd know how to make things like this. Thank you so so much.

Hello! it used to work well but today it doesn't work anymore?

@5VENY

This comment has been minimized.

Copy link

@5VENY 5VENY commented Aug 31, 2020

Probably your Facebook language should be English to use below.
Here is my solution as the 4th of May, 2020:

const follows = document.querySelectorAll('div[aria-label="Toggle to follow"]')
for (let i = 0; i<follows.length; i++) {
  setTimeout(() => follows[i].click(), i * 1500)
}

This one worked for me @31/08/2020

@laudalashan

This comment has been minimized.

Copy link

@laudalashan laudalashan commented Sep 2, 2020

How do I unfollow everyone that is not my friend on Facebook at once?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.