---
title: strings.CountWords
description: Returns the number of words in the given string.
categories: []
keywords: []
params:
  functions_and_methods:
    aliases: [countwords]
    returnType: int
    signatures: [strings.CountWords STRING]
aliases: [/functions/countwords]
---

```go-html-template
{{ "Hugo is a static site generator." | countwords }} → 6
```
