---
page_title: chunklist function reference
description: |-
  The `chunklist` function splits a single list into fixed-size chunks and returns
  a list of lists. Learn how to use the `chunklist` function in Packer templates.
---

⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
> [!IMPORTANT]  
> **Documentation Update:** Product documentation previously located in `/website` has moved to the [`hashicorp/web-unified-docs`](https://github.com/hashicorp/web-unified-docs) repository, where all product documentation is now centralized. Please make contributions directly to `web-unified-docs`, since changes to `/website` in this repository will not appear on developer.hashicorp.com.
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️

# `chunklist` Function

`chunklist` splits a single list into fixed-size chunks, returning a list
of lists.

```hcl
chunklist(list, chunk_size)
```

## Examples

```shell-session
> chunklist(["a", "b", "c", "d", "e"], 2)
[
  ["a", "b"],
  ["c", "d"],
  ["e"]
]
> chunklist(["a", "b", "c", "d", "e"], 1)
[
  ["a"],
  ["b"],
  ["c"],
  ["d"],
  ["e"]
]
```
