Script error Categories, a software feature of MediaWiki, provide automatic indexes that are useful as tables of contents.

You can categorize pages and files by adding one or more Category tags to the content text. These tags create links at the bottom of the page that take you to the list of all pages in that category, which makes it easy to browse related articles.


Each of the pages in the Category namespace represents a so-called category, a grouping of related pages, and contains an index for the pages of its category. For example, this page belongs to "Category:Help". If you open the "Category:Help" page, you will see a link to this page there.

When a page belongs to one or more categories, these categories appear at the bottom of the page (or in the upper-right corner, depending on the skin being used).

The category pages themselves contain 2 parts :

  • at their beginning, an optional part may contain text that can be edited, like any other page,
  • at their end, an ever present, automatically generated, alphabetical list of all pages in that category, in the form of links. (In fact, in ASCII order. See Help:Special page).

To assign a category to a page, simply add the link "[[Category:Category name]]" to the page's wikitext. The usual place to add it is at the bottom of the page.

To link a category page within a page as a normal wiki link (without adding the page to the category), prefix the link name with a colon. For example: [[:Category:Not in this category]]

New categories can be created before assigning any page to it, in the same way as any other regular page.

Individual wikis may have their own top-level categories, such as Category:Contents in Wikipedia.

For a complete list of all categories which have at least one page, see Special:Categories.

For a complete list of all created/edited categories, including the ones that don't have any page, see Special:Allpages/Category: (note the colon at the end).

Adding a page to a category

To add a page or uploaded file to a category, simply edit the page and add the following text (where Name is the name of the category you want to add it to).


Any number of Category tags may be added to the page and the page will be listed in all of them. Category tags, along with interwiki language links placed in the sidebar, are usually added at the very bottom of the page for the convenience of other editors.

On a categorised page, categories are displayed in the Categories: box strictly in the order they appear in the wikitext.

If $wgUseCategoryBrowser is set to true, under the first list each category is listed again, breadcrumb-style, with all its parent categories, sorted alphabetically. (At least in MediaWiki 1.18.2) if a category is a subcategory of more than one parent, both hierarchies will be listed, but the tagged category will be stripped off all but one of these. This creates the potential for what appear to be duplicate entries if a category with multiple parents and one of its parents are both tagged on a page. For example suppose Maryanne is a subcategory of both Mary and Anne. If a page tags categories Maryanne and Anne then the Category breadcrumbs will show

Mary -> Maryanne

"Anne" appears to be duplicated, but what is meant is

Anne -> Maryanne
Mary -> Maryanne

This is probably a bug, and has been reported in Bug 33614.

Sort key

By default, a page is sorted within a category under the first letter of its name — without the namespace. Also, MediaWiki groups accented characters separately from their unaccented version, so pages starting by À, Á, Ä, will be listed under separate headings, instead of under heading A. (If you have shell access, these defaults can be changed using $wgCategoryCollation.)

A sort key specifies under which letter heading, and where in the category list, the page will appear. You can add a sort key by placing it inside the tag after a pipe character. For example, the tag below will add the page under heading "S".


Sort keys are case-sensitive, and spaces and other characters are also valid. The order of the sections within a category follows the Unicode sort order. The sort key does not change the page title displayed in the category.

See Help:Sorting for further information on category sorting.

Creating a category page

Categories exist even if their page has not been created, but these categories are isolated from others and serve little purpose for organization or navigation.

A category is created by creating a page in the Category: namespace. A category page can be created the same way as other wiki pages (see Help:Starting a new page); just add "Category:" before the page title.

To avoid extra work, try searching within your wiki before creating a new category. The list of all categories can be found in "Special pages" in the "toolbox" box of the sidebar.

Unlike other wiki pages, it is not possible to rename (move) a category. It is necessary to create a new category and change the Category tag on every page. The new category will not have the older category's page history, which is undesirable if there are many revisions.

Managing the category hierarchy

Categories may belong to other categories in a hierarchy. Since category pages are much like any other page, a Category tag may be added to the bottom of a category page.

It is a good idea to organize all categories into a hierarchy with a single top level category. The category structure can take the form of a tree with separate branches, but more often will have a graph structure. Generally, there should be a contiguous chain of parent-child links between each category and the top level category.

Hidden categories

The categories that a page is in are normally listed at the bottom of the page. In Mediawiki 1.13+, a category can be hidden from this list by adding the magic word "__HIDDENCAT__" to the category page. Hidden categories are not hidden from category pages (bug 15550).

Users can choose to see hidden categories in a separate "Hidden categories" list, by checking "Show hidden categories" in the "Appearance" section of Special:Preferences.

Hidden categories are automatically added to Category:Hidden categories. This category is specified in the system message MediaWiki:Hidden-category-category.

See also: hidden categories

Linking to a category

To create a link to a category, use a leading colon before the category name (without this colon, the current page would be added to the category):


To change the link text, write the text inside the link tag after a pipe:

[[:Category:Help|Help category]]Help category

Redirect pages that redirect to categories must also use the colon, otherwise they will be added to the category instead of redirecting.

Redirecting a category

Like normal wiki pages, category pages can be redirected to other normal or category pages. However, this is not recommended, as pages categorised in redirected categories do not get categorised in the target category (bugzilla:3311). Some Wikimedia sites use a "category redirect" template to mark redirected categories, allowing manual or automated cleanup of pages categorised there.

Tracking Categories

Certain syntax issues, such as a broken image link, or too many expensive parser functions, can cause a page to be added to a tracking category. See Help:Tracking categories for details.

See also

Language: English

Categories seen at the top of the page, including a view of the drop-down when you click on "more"

A category is a group of pages that are in some way similar enough to group together. Maybe the category speaks to function on your wiki — such as templates, images or users. Or maybe it describes something about the page content, like characters, books, or locations. You can add a category link to any page, and it will automatically be listed on a category page with other similarly-linked pages.

In other words, categories are structural, navigational tools. And they can be found in the article header and at the bottom of the page.

Why categories are important

Categories help organize the community and make it easier for readers to find related content. Ideally, every wiki page should be in at least one category. Since categories can be within other categories, you can start to build a structure — a "category tree" — which lets your readers move around your site. For example, a person might start on a page in Main characters, then move up to Characters, then move back down again to Minor characters and then on to Minor characters from season 7. They're able to do this because Main characters acts as the trunk of a tree on which the branches of the other categories about characters are hung.

Aside from these navigational uses, proper categorization is crucial to a number of other processes, like:

These and other features won't work as well if your wiki's category structure is weak.

Adding a page to a category

To add a category, begin by going to the page you wish to categorize. Then use either the category module at the bottom of the page, or an editor, to add your category.

From the category module

CategorySelect suggest

Adding a category via the category module. Note how existing categories are suggested to you.

Use the category module, and you don't have to open an editor. Just go to the bottom of the page, where the existing categories are.

  • Click on the Add category button, and start typing in a category name.
  • You can use an already-established category (suggestions will appear as you type) or add a new one.
  • Once you are done, hit save and the category will appear on the article.

If you would prefer not to use this ability, you can disable it by going to your personal preferences. Once there, click on the Editing tab, check the box next to Disable Category module and then save your preferences.

While editing

How you add categories while editing depends on which of our three editors you choose to use:



In VisualEditor, first find the dropdown menu in the upper right


In the VisualEditor, these are some of the categories that are suggested on a page about Rey from Star Wars.

In the VisualEditor you first have to click on the dropdown menu to the left of the Cancel button and pull down to Categories.

Once you're in the Categories dialogue box, enter a category into the top field. Existing categories will show up as you type in more letters. You can then just select from that list.

If you want to change the way the page is sorted, you can do that in the second field. Most of the time, you'll probably go with the default — which is just the way the title naturally appears. But for people, you might want to sort by last name. So if the page is named Charlie Brown, you might enter Brown, Charlie in that second box.

Once you've got things how you want them, click on Apply changes. This only makes the category a part of your potential edit, though.

To publish the change to the live page, click on Save page when you're returned to the main editing pane of the VisualEditor.

Classic rich-text editor

Adding category edit mode

Adding, removing or editing a category from the editor

On the right hand side of the editor is a Categories module. Click to expand this and you will see a list of the categories already present.

  • To add a category, type the category name in the input area above the existing categories. As you type, you will see suggestions appear.
  • Click the pencil next to each category to edit that category's settings.
  • Click the trash can to remove the category.

Source editor

While in source, you can add the category name as a link to the bottom of the page itself (e.g. [[Category:Help]]), or use the category module in the right rail.

By default, exiting categories appear in the category module in the right rail. However, if you choose to disable the category module in your preferences, they do appear at the very bottom of the page.

Sort parameters

  • When clicking the edit icon next to category names, you can define a "sortkey" for that category. This sortkey defines at what point the article appears in a category page's listings, e.g., sort a first last name page under last name.
  • If an article example is the introduction for category example, a blank (space) or * (asterisk) sortkey puts it near the begin of the category.
  • If the article is in many categories, you can add {{DEFAULTSORT:<sort key>}} in the article while editing in source mode to sort the article in all the categories the same way. This will save you from having to edit each category's parameters individually.

Category pages matter

Categorical Pseudo-existence

When pages are in a category that hasn't been fully created

As soon as you add a category to a page, that category will appear in Special:Categories. And you can reach the category page by clicking on the category link, or by entering the address into your browser. So the category sort of works.

But, as you can see from the picture at the right, the category page still needs to be created. Until it exists, the category is partially powerless. It won't be suggested when you try to add it to another page. You can't use it on a Mobile Main Page. And it's not a full member of your Special:CategoryTree.

So take the time to fully create your categories.

Creating a category page

Because categories without category pages aren't suggested, you'll save yourself a lot of time if you create a category before you put a single page into it.

To do this, start a new page — called Category:Name — in any of our editors. Add a sentence or two which explains what the category is about. Then add the page to another category that has already been created.

For instance, let's say your wiki is about the Marvel Universe, and you're starting a category about female heroes in the Marvel Cinematic Universe (aka Earth-199999). So you create the category Female superheroes (Earth-199999) by adding the text:

Female superheroes of Earth-199999 came from every part of that Earth, exhibiting a wide range of powers, both meta—human and mortal. This category collects pages on this wiki about them, as well as many images and videos featuring their exploits.

Then you add it to Category:Earth-19999 and hit Publish.

This step is crucial, because once you publish a category page, it then will be usable by the category module. That is, it will appear as an auto-suggestion when you try to add it to other pages.

It will also be usable by all bots, DynamicPageList, the Help:Mobile Main Page, and other features.

While a description of the category is optional, it does help your wiki's SEO to add a brief summary of the category.

Deleting a category

To delete a category, first remove the category tag from all pages in the category as described above.

An admin can then delete any content on the category page itself by using the "Delete" option in the Edit menu dropdown, the same way a regular page is deleted.

A category page that has not been created will display the "Create" button in the top right corner of the page. In this case, the category listing can be deleted simply by removing it from all pages it was on. The category will then no longer appear in the list of categories (Special:Categories) and is fully deleted.

Category page layout

For registered users, there are three different layout options. The layout you see upon arrival at a category page can be set in your preferences. Once there, open the My Info tab, scroll down to the Appearance section, use the drop-down next to Category page layout to select the default layout, and save your preference changes. While viewing a category page, registered users can switch between layout options by using the layout buttons in the top-right corner of the page.

Anonymous users are shown the dynamic categories layout and cannot switch layouts.

If the category page has been created, the page content specified while creating/editing the category page will be displayed first; above the auto-generated content. The following subsections describe the auto-generated content.

Classic Categories

The first section is an image gallery featuring up to eight of the most popular pages from the category. The images are arranged in rows with as many as four images per row. Each image serves as a link to its respective page.

The second section is a list of subcategories and the third section is a list of pages. The layout of the lists are similar to each other. If a list has no items to display, its section is not displayed. The sections contains a count of the total number of list items and a list of up to 200 items. If there are more than 200 items in the list, links to view the next/previous items will be placed both above and below the list. The list is organized into as many as three columns and sorted alphabetically by sortkey. If the CategoryTree extension is enabled (it should be by default), the subcategory list will display each item as a category tree instead of a link to the category page.

Category Gallery

By default, all categories on Fandom have a Category Gallery at the top of the category page itself. This shows a small image and link for each of the 8 most popular pages in that category. The image shown is usually the first image on each page.

  • If a page has no suitable graphics, then the first few lines of text will appear. Suitable images must be:
    • Larger than 130px by 115px
    • Used ten or fewer times on the wiki in content namespaces
    • Not an SVG
  • If you have a community where this display does not work well, you can add the expression __NOCATEGORYGALLERY__ to the top of the page to remove it. You can also request that it be disabled on all pages through Special:Contact.

Category Exhibition


A category with Category Exhibition enabled.

Category Exhibition is an optional display method for category pages. It can be turned on in your account preferences.

  • In the exhibition image mode, every page in the category is displayed as an image with a link. Images can be displayed in alphabetical or most visited order.
  • A small toggle option on the upper right of the page allows users to choose a "list" (lines) or image (squares) view.
  • In list mode, the category gallery appears above an alphabetical listing of all pages in the category.

Dynamic Categories

The first section is an image gallery similar to the one used by the classic categories layout. Although similar in layout, the galleries may feature different pages due to a difference in selection criteria. The gallery for dynamic categories cannot be disabled.

The second section contains a count of the total number of list items and a list of up to 200 items. The list contains both subcategories and pages sorted alphabetically by sortkey. The list is organized into two columns and, where possible, each item contains an image from its respective page. Above the list is a series of links that allow the viewer to skip to a specific letter in the alphabet. Below the list, next and previous buttons are displayed.

Further reading

Further help and feedback

Community content is available under CC-BY-SA unless otherwise noted.