GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||
GeezerVison is showing en.wikipedia.org — Help:Template limits - Wikipedia
The MediaWiki software that powers Wikipedia has several parameters that limit the complexity of a page, and the amount of data that can be included. These limits mainly concern data that is transcluded or substituted during expansion of a page, as opposed to data directly in the source of the page itself. This page explains how and why these limits are applied, and how users can work within the limits. BackgroundWhat is this about?The MediaWiki software, which generates the HTML of a page from its wiki source, uses a parser to deal with included data. This is done using a "preprocessor" which converts the wikitext into a data structure known as an XML tree, and then uses this tree to produce "expanded" wikitext, where double- and triple-braced structures are replaced by their result. During the conversion process, the software uses several counters to track the complexity of the page that is being generated. When the parsing of a page begins, these counters are set to zero, but they are incremented during the parsing process, as described below. There are upper limits on these counters, and the parser does not allow these limits to be exceeded. Why are there limits?Very long or complicated pages are slow to parse. Not only is this an inconvenience for users, but it can also be used to mount a denial of service (DoS) attack on the servers, in which a page request forces the MediaWiki software to parse an unreasonably large quantity of data. The limits help to prevent this kind of attack, and ensure that pages are rendered in a reasonable time. (Nevertheless, sometimes a complex page within the limits gives a time-out error; this depends on how busy the servers are.) Working within the limitsWhen a page reaches the template limits, the most common solution is to make the templates shorter, using methods described below. If this isn't possible, it may be necessary to include more data directly in the page source, rather than transcluding it from templates (e.g., formatting references by hand or using When do problems arise?See also: Help:Template § Expand limits
The inclusion limits are most commonly reached on pages that use the same template many times, for example using one transclusion per row of a long table. Even though the amount of data that the template adds to the final page may be small, it is counted each time the template is used, and so the limit may be encountered sooner than expected. Pages that only include a few dozen templates are unlikely to exceed the inclusion limits, unless these templates themselves include a lot of data. How can you find out?Further information: mw:NewPP parser report
Once the page body is processed, an HTML comment is added towards the end of the HTML code of the page with the final values of the various counters. For example, the page HIV/AIDS (as of the revision on October 10, 2025) contains the following comment in its generated HTML source: <!-- NewPP limit report Parsed by mw‐web.eqiad.main‐d976f4d78‐dn5sb Cached time: 20251016210947 Cache expiry: 2592000 Reduced expiry: false Complications: [vary‐revision‐sha1, show‐toc] CPU time usage: 2.718 seconds Real time usage: 3.084 seconds Preprocessor visited node count: 22714/1000000 Revision size: 219436/2097152 bytes Post‐expand include size: 953824/2097152 bytes Template argument size: 11844/2097152 bytes Highest expansion depth: 15/100 Expensive parser function count: 42/500 Unstrip recursion depth: 1/20 Unstrip post‐expand size: 1369326/5000000 bytes Lua time usage: 1.640/10.000 seconds Lua memory usage: 22826184/52428800 bytes Number of Wikibase entities loaded: 1/500 --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 2560.861 1 -total 61.06% 1563.754 1 Template:Reflist 30.06% 769.671 175 Template:Cite_journal 12.13% 310.653 74 Template:Cite_web 8.44% 216.167 13 Template:Navbox 6.91% 177.039 42 Template:Cite_book 6.26% 160.248 1 Template:Medical_resources 5.01% 128.211 2 Template:Hlist 3.76% 96.295 2 Template:Short_description 3.56% 91.196 1 Template:Subject_bar --> <!-- Saved in parser cache with key enwiki:pcache:5069516:|#|:idhash:thumbsize=4 and timestamp 20251016210947 and revision id 1316019162. Rendering was triggered because: page_view --> (Some items may not be present on other wikis, depending on which extensions they have installed; for example, the "Lua" items are added by Extension:Scribunto.) Because of the way the counters are increased, the preprocessor visited node count, post-expand include size, and template argument size will usually be less than their limits. If any of these items are close to their limit, then it is likely that some of the templates have not been expanded. Each occurrence of an unexpanded template is identified in the page body by an HTML comment containing an error message. Click "Parser profiling data" at the bottom of a preview to see similar data for the preview without saving it. ExpansionTemplates in non-executed branches of conditional parser functions are not expanded, and therefore not counted. For example, in the code Preprocessor node countThe preprocessor node count measures the complexity of the page (not the volume of data). As the parser is expanding a page, it creates a data structure known as a tree that corresponds to the HTML structure of the page. Each node of the tree that is visited during expansion is counted towards the preprocessor node count. If this count is exceeded, the parser will abort parsing with the error "Node-count limit exceeded" visible in the generated HTML. The count starts with 1 for plain text. A pair of nowiki tags counts for 3, a header for 2, etc. A link does not contribute to the count. For the expansion of Pages exceeding this limit are automatically categorized into Category:Pages where node count is exceeded (recent additions). Post-expand include sizeThe post-expand include size (PEIS) is the sum of the lengths of the expanded wikitexts generated by templates, parser functions and variables. Whenever the parser is instructed by the source code of a page to expand a template etc. (that is, to replace it by transclusion or substitution), the parser adds together the length of the expanded wikitext generated by the template etc. and the current counter value of the page. If this sum is more than the post-expand limit (same as the max article size limit; see Template invocations with no arguments have an expanded text cache. So if Pages exceeding the post-expand include size limit are automatically added to Category:Articles where post-expand include size is exceeded (recent additions), Category:User pages where post-expand include size is exceeded (recent additions), or Category:Pages where post-expand include size is exceeded (recent additions). Template:Citations broken from PEIS limit may be manually added to the page when citations or templates are broken as a result of the issue. Using comments, noinclude and onlyincludeOnly data that survives the preprocessor expansion stage is counted towards the post-expand counter. The length of HTML comments in the wikitext (which are not reproduced in the HTML source produced) is not included in the post-expand counter. Code which is either inside a Nested transclusionsNote that the sizes of the wikitexts of all expanded templates and parser functions are added, even in the case of nesting (see phab:T15260), so extra levels increase the count. If page A transcludes B and B does nothing but transclude C, then the size of C will be counted twice towards the post-expand include size on page A, and similarly if a template consists of a parser function call, or a parser function has a template call as parameter, etc. Possible substitutions to reduce nesting include:
Non-rendered transclusionsNon-rendered tranclusions still count towards limit. For example, a page which contains only
The same applies to Scribunto modules. For example, mw.getCurrentFrame():preprocess'{{msgnw::Main Page}}' -- remove this line and post-expand include size becomes zero return { main = function() end } -- p.main() has no return value #invoke syntax
Some templates have equivalent Lua modules, which may be transcluded with the syntax
ReferencesPages may exceed the limit when trying to display references using the {{reflist}} template. Replacing it with Splitting articlesIdeally the length of articles would be determined by content-related decisions not technical issues. However, if PEIS issues are unresolvable on an article such as a long list, it may be split into sections which each fit within the limit, following the policy at WP:SPLIT. Template argument sizeThe template argument size counter keeps track of the total length of template arguments that have been substituted. Its limit is the same as the article size limit. Example:
Arguments in the template call which do not match any parameter tag in the template do not count. If a template contains a switch, use of template arguments beyond a match do not count. Up to and including the matching case, template arguments used on the left of the equals signs count twice. Those on the right of the equals sign count for the matching case only. Pages exceeding the template argument size limit are automatically added to Category:Pages containing omitted template arguments (recent additions). Highest expansion depthFurther information: Wikipedia:Avoiding MediaWiki expansion depth limit
Pages exceeding this limit are automatically categorized into Category:Pages where expansion depth is exceeded (recent additions). Expensive parser function callsFurther information: mw:Manual:$wgExpensiveParserFunctionLimit and Template:Expensive
There is a limit of 500 to the expensive parser function count, i.e., the number of calls of expensive parser functions, which are:
The limit-exceeded error can be caught with It is also possible to manually increment the expensive parser function count from a Lua module by using Pages that exceed this limit are automatically categorized into Category:Pages with too many expensive parser function calls (recent additions). Unstrip post-expand sizeThe unstrip post-expand size counter tracks the total bytes added via TemplateStyles (the #timeThe total length of the format strings of function Unfortunately, the count is not in the limit report. ImagesAs of July 2026, the new Parsoid parser has a limit of 1,250 (previously 1,000) images per page (see phab:T430854). If Parsoid was used then the bottom of the page says "Page was rendered with Parsoid". You may be able to render all images for yourself by adding Special:ExpandtemplatesWhen a page exceeds the limits, one crude way to solve the problem is to use Special:ExpandTemplates. As opposed to substitution it recursively expands all levels at once, without the need of specially preparing the templates with the code HistoryThe inclusion limits were put into effect on the English Wikipedia by Tim Starling on 14 August 2006. A new preprocessor was enabled in January 2008, removing the "pre-expand include limit" and replacing it with a "preprocessor node count" limit. The practice of using a template documentation page, while it can still be useful for other reasons, is no longer needed for avoiding documentation to be counted on pages that call the template. References
See also | |||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |