# chunkCountForPlaintext

> **chunkCountForPlaintext**(`plaintextLength`, `chunkSize`): `number`

Defined in: [packages/filecoin-encryption-envelope/src/chunk-layout.ts:121](https://github.com/FilOzone/synapse-sdk/blob/9ad84d812e1dd635b76420a7d9388555a04f31b6/packages/filecoin-encryption-envelope/src/chunk-layout.ts#L121)

Chunk count for a plaintext of the given length: `max(1, ceil(P / S))`.
The `max` matters — `ceil(0 / S)` is zero, and empty plaintext is still
one chunk, carrying nothing but its tag.

Use this to *predict* a layout from a plaintext length, never to validate
a stored one. A declared `plaintext_length` is checked through
[ciphertextLengthForPlaintext](/reference/filoz/filecoin-encryption-envelope/namespaces/chunklayout/functions/ciphertextlengthforplaintext/) against the observed ciphertext
length, never by running this in reverse.

## Parameters

| Parameter | Type |
| ------ | ------ |
| `plaintextLength` | `number` |
| `chunkSize` | `number` |

## Returns

`number`