Linksweeper removes backlinks (links, templates, files, and categories) from pages listed in special pages such as Special:Wantedpages, Special:Whatlinkshere, and Special:Wantedfiles. It also allows clean-up of links entered in the dialog box.

Important Note: Be careful when cleaning up categories. Due to the way links are created this script will also remove categories from pages, and not just their links (needs a fix at some point), e.g. [[Category:Sweepy]] and [[:Category:Sweepy]].


Add this JavaScript on your wiki:

linkSweepConfirmation = true;
LinkSweeperDelay = 1000;
importArticles({ type: 'script', articles: [
importArticles — Best Practices for installing JavaScript on FANDOM
The importArticles statement is designed to combine multiple HTTP requests into a single data transfer, allowing multiple scripts to load and execute faster. If you've been installing several different scripts, your JavaScript file has probably accumulated unnecessary import statements. Click "Expand" to learn how to efficiently batch import scripts to speed up performance and make your code look cleaner. One other approach is by using the MediaWiki:ImportJS.
If your JavaScript file has several lines of code that say importScript, importScriptPage, or importArticles, you may be able to combine them! By batch importing a collection of scripts with a single import, your JavaScript code will load faster and look cleaner. Consider the example below. On the left is an example of what your JavaScript file might currently look like. On the right is how you could improve that code.
Multiple imports — messy and slow One import — clean and efficient
  type: 'script',
  article: 'u:dev:FloatingToc/code.js'
importScriptPage('page1.js', 'wikiname');
importScriptPage('page2.js', 'wikiname');
    type: 'script',
    articles: [
Note: In this example, pay close attention to the placement of commas and other punctuation. For people who aren't familiar with programming (and even those who are!), a common mistake when writing code is to accidentally delete, forget, or misplace critical symbols like commas or quotation marks. This can cause a syntax error that breaks the code. Carefully follow the convention shown here when using importArticles.
But there's much more to importArticles than just this! For more examples and advanced usage, see the help page at Help:Including additional JavaScript and CSS.


  • Removes templates, file links (including from gallery), and normal links
  • Pulls in links to remove from special pages or category
  • Shows backlinks in the modal (popup) from any page
  • Toolbar link
  • Button to fetch all redlinks in a page


Click "remove backlinks" button on Special:WantedPages or Special:Whatlinkshere. One can also change some script settings by putting the options before the importarticles:

window.linkSweepConfirmation = true; 
window.linkSweeperDelay = 1000; //milliseconds
window.linkSweeperRedlist = {"wantedpages" : 1};
window.categoryList = [];

LinkSweepConfirmation adds a confirm dialog before attempting to remove the links, set true to show this dialog always. LinkSweeperDelay is the number of milliseconds before the next removal, this prevents flooding the wiki with too many requests.

The category allows users to add custom categories to fetch links to clean, e.g. :

window.categoryList = ["myfavcat", "spam"]

The linkSweeperRedlist consists of pages where the link sweeper will show up the to help remove links. It can be configured to work in additional special pages by adding the canonical name of a special page. However, it has only been tested with the default special pages (the ones below), and may not work in others. To use this configuration add each name as in the example below (canonical name in quotes, followed by colon and "1" , followed by a comma):

window.linkSweeperRedlist = {
      "wantedpages": 1,
      "whatlinkshere": 1,
      "wantedfiles": 1,
      "listredirects": 1,
      "uncategorizedpages": 1

Completely removing a link

By default the scripts only removes the square brackets from the link. However, there is a checkbox "delete links?" that enables a more aggressive mode, and completely removes the link from a page:

  • Normal mode - Replaces a link like [[Bazooka]] with "Bazooka"
  • Delete mode - Replaces a link like [[Bazooka]] with "" (empty text)


  • It will only check a max of 500 backlinks.
  • It will not work on links constructed by templates or lua modules.
  • It will automatically append "--<nowiki>" to the module namespace to eliminate those invalid reports.


  • 2016/05/05 Added button to fetch all redlinks in a page and improved template detection
  • 2016/04/16 Added custom list of categories to fetch pages
  • 2016/04/01: Added support for cleaning templates, added category button, button for batch removal in special pages
  • 2016/03/17: Added support for cleaning links in galleries
  • 2016/03/16: Added support for removing many links at once, added show backlinks button
  • 2016/03/12: Added Link to Wikia oasis skin (mytools) and "?action=delete"
  • 2016/03/10: Bug fix (normalize page titles: compare spaces, colon trick
  • 2016/03/09: Bug fixes and new features (arbitrary link page, custom summary, support for Special:Wantedfiles, namespace, delete & de-link)
  • 2016/03/05: Initial commit

See also

Start a Discussion Discussions about Linksweeper

  • Request for Link Removal Script

    59 messages
    • Colouratura wrote: ideally you can test it by copy pasting it into your console To import it permanently you'd need to add it directly...
    • That did nothing, I'm getting the exact same error.