Text tool

Truncate List

Shorten a long list to an exact maximum number of retained items while preserving their original order and choosing which end to keep.

In-browser processingNo account requiredPrivacy details ↗

Maximum 100,000 characters and 50,000 parsed items. Retained items keep their original order.

Choose a whole number from 0 to 50,000. Zero returns an empty result.

Items stay in their original order.

A QUICK WALKTHROUGH

How to use this tool

  1. Paste a list up to 100,000 characters and choose its literal input separator.
  2. Enter how many items to keep, choose the beginning or end, and set cleanup rules.
  3. Truncate the list, review the retained items, then copy them or download a text file.

Keep a prefix or suffix

Choose the beginning to keep the first N retained items or the end to keep the last N. A count of zero returns an empty result, while a count larger than the list returns every retained item. The tool never reorders the selected items.

Literal separators with bounded input

Choose newline, comma, tab, semicolon, or one to 20 literal custom characters for input and output. Regular expressions are never executed. Optional trimming and empty-item removal happen before the count is applied. Input is limited to 50,000 parsed items and output to 500,000 characters.

GOOD TO KNOW

Common questions

What happens when the count is larger than the list?

Every retained item is returned in its original order.

Can I keep items from the end?

Yes. Choose End of the list; the last N items are retained without reversing them.

Does zero mean keep everything?

No. A count of zero intentionally returns an empty result. Use a count at least as large as the list to keep everything.