# Chunk

Break arrays or collections into smaller (wait for it) chunks of any given size. This is useful for performing various gymnastics with your HTML markup.

:::tip
Want a set number of _groups_ regardless of item count? The [split](/modifiers/split.md) modifier does the opposite — give it a _count_ and it divides the collection into that many roughly equal pieces.
:::

::tabs

::tab antlers
```antlers
{{ collection:news as="posts" limit="6" }}
  {{ posts chunk="3" }}
  <div class="flex space-x-4">
    {{ chunk }}
      <a href="{{ url }}" class="bg-purple-800 text-white p-4">
        {{ title }}
      </a>
    {{ /chunk }}
  </div>
  {{ /posts }}
{{ /collection:news }}
```
::tab blade
```blade
<s:collection:news as="posts" limit="6">

  @foreach (Statamic::modify($posts)->chunk(3) as $chunk)
    <div class="flex space-x-4">
      @foreach ($chunk['chunk'] as $entry)
        <a href="{{ $entry->url }}" class="bg-purple-800 text-white p-4">
          {{ $entry->title }}
        </a>
      @endforeach
    </div>
  @endforeach

</s:collection:news>
```
::

```html
<div class="flex space-x-4">
  <a href="/ideas/book" class="bg-purple-800 text-white p-4">
    Book: Somehow I Manage
  </a>
  <a href="/ideas/party" class="bg-purple-800 text-white p-4">
    Party: Goodbye Toby
  </a>
  <a href="/ideas/screenplay" class="bg-purple-800 text-white p-4">
    Screenplay: Threat Level Midnight
  </a>
</div>
<div class="flex space-x-4">
  <a href="/ideas/art" class="bg-purple-800 text-white p-4">
    Art: A Stapler
  </a>
  <a href="/ideas/poster" class="bg-purple-800 text-white p-4">
    Poster: Kids Playing Instruments
  </a>
  <a href="/ideas/mug" class="bg-purple-800 text-white p-4">
    Mug: World's Best Boss
  </a>
</div>
```
