1---
2title: countwords
3description: Counts the number of words in a string.
4date: 2017-02-01
5publishdate: 2017-02-01
6lastmod: 2017-02-01
7categories: [functions]
8menu:
9  docs:
10    parent: "functions"
11keywords: [counting, word count]
12signature: ["countwords INPUT"]
13workson: []
14hugoversion:
15relatedfuncs: [countrunes]
16deprecated: false
17---
18
19The template function works similar to the [.WordCount page variable][pagevars].
20
21```
22{{ "Hugo is a static site generator." | countwords }}
23<!-- outputs a content length of 6 words.  -->
24```
25
26
27[pagevars]: /variables/page/
28