# Segment

Split documents into text chunks of a target length for extraction or retrieval.

For splitting by headings, use [Hierarchical Document Splitting](../other/hierarchical-chunking.md). This node controls the length and overlap of text that can be split.

## Configure chunking

Bind a nonempty upstream `documents` array.

| Setting | Description |
| --- | --- |
| Chunk size | Configuration default: 800; target length for splittable text |
| Overlap | Configuration default: 100; characters repeated between adjacent chunks |

Chunk size must be positive. Overlap must be at least 0 and less than chunk size. Length is measured in characters, not model tokens.

## Preserve document structure

Tables and code blocks retain their structure. Markdown records containing code blocks can also exceed the target length. Images and audio/video segments are handled according to their own structure.

If the next node has an input length limit, check the actual length of large tables and code blocks.

## Use the output

The output `documents` contains chunks with source metadata and chunk positions. Connect it to text embedding, extraction, or knowledge base writing nodes.

## Example: chunk a product manual

Flow: General Document Parsing → Segment → Embed and Add to Knowledge Base.

Set chunk size to 800 and overlap to 100. Check that split sentences retain enough context, and inspect long tables and code blocks separately.

## Related pages

- [Variables and data flow](../../variables-and-data.md)
- [Run and debug](../../run-debug.md)
