Truncate text to a max length

Truncate cuts text down to a maximum number of characters and, by default, marks the cut with an ellipsis indicator. Pick the Length ceiling, the Side to cut from, the Indicator string to insert, and whether the truncate is per-line or applied to the whole input. To pad up to a width instead of cutting down, see pad left or pad right.

Input
Line 1:1 LF cloud_done Saved locally
Result Truncate Text
0 lines 0 chars

Cap, with optional indicator and side selection

Length is the maximum character count of the output (per line if Per Line is on, otherwise of the whole input). If the source is at or under Length it passes through untouched. If it is over, the tool slices it down. Length is bounded 1 through 100,000 in the registry.

Side picks which end is cut. Right (default) keeps the start of the text and drops the tail. Left keeps the tail and drops the start. Ellipsis on inserts the Indicator string at the cut edge; off cuts cleanly with no marker. The default Indicator is ...; replace it with [...], …, or anything else you want.

Indicator length is included in the budget. So at Length 10 with Indicator ... the output keeps 7 characters of the source plus the 3-character indicator, total 10. With Ellipsis off the cut keeps the full Length of source. Per Line on applies the same rule to each line; off applies it to the whole input as one string.

How to use truncate text to a max length

  1. 1Paste your text into the input panel on the left.
  2. 2Set Length to the maximum character count.
  3. 3Pick a Side: Right cuts the tail, Left cuts the start.
  4. 4Toggle Ellipsis off if you want a clean cut, or change the Indicator if you want a different marker.
  5. 5Toggle Per Line on if each line should be truncated independently.

Keyboard shortcuts

Drive TextResult without touching the mouse.

Shortcut Action
Ctrl FOpen the find & replace panel inside the input Plus
Ctrl ZUndo the last input change
Ctrl Shift ZRedo
Ctrl Shift EnterToggle fullscreen focus on the editor Plus
EscClose find & replace, or exit fullscreen
Ctrl KOpen the command palette to jump to any tool Plus
Ctrl SSave current workflow draft Plus
Ctrl PRun a saved workflow Plus

What this tool actually does

Pass-through under the limit

Text at or shorter than Length is returned unchanged with no indicator inserted. Truncate only fires when the source is strictly longer than the limit.

Side picks the cut end

Right keeps text.substring(0, len - ind.length) and tacks the indicator on the end. Left keeps text.substring(text.length - len + ind.length) and prefixes the indicator on the start.

Ellipsis is configurable

When on, the Indicator string (default ...) is inserted at the cut edge and counts toward the total length budget. When off, the cut is clean and the full Length is filled with source characters.

Per Line truncates each line independently

With the toggle on the input is split on \r?\n, each line is checked against Length, and the result is rejoined with \n. With it off the whole input is treated as one string.

Length cap is 100,000 characters

The registry bounds Length between 1 and 100,000. That covers tweet-sized snippets, SMS limits, and large editor blocks without hitting browser memory limits.

Worked example

Length 26, Side Right, Ellipsis on, Indicator .... The first 23 source chars plus the 3-char indicator total 26.

Input
The quick brown fox jumps over the lazy dog by the river bank.
Output
The quick brown fox jum...

Settings reference

Behaviour Effect on output
Length (1-100000) Maximum character count of the output.
Source at or under Length Passes through unchanged. No indicator inserted.
Side = Right Tail is cut. The start of the text is kept.
Side = Left Start is cut. The tail of the text is kept.
Ellipsis on Indicator string is inserted at the cut edge and counts toward Length.
Ellipsis off Clean cut. Length source chars are kept; no indicator.
Indicator Marker string when ellipsis is on. Default ...; any string accepted.
Per Line on Each line is truncated independently against Length.
Per Line off The whole input is truncated as one string.
On Word off (default) Cut lands at the exact character position - may split a word mid-letter.
On Word on Cut moves to the nearest whitespace within the budget so the kept text ends on a complete word. If no whitespace lies within half the budget, falls back to the character cut.

FAQ

Does the indicator count toward Length?
Yes, when Ellipsis is on. The kept source characters plus the indicator total exactly Length. Turn the toggle off if you want Length source characters with no marker.
How do I keep the end of the text instead of the start?
Set Side to Left. The cut happens at the start, so the tail of the source is preserved.
Can I change the indicator?
Yes. Edit the Indicator field. Common alternatives are [...], … (single-char ellipsis), or a custom marker.
What if I want to truncate at a word boundary, not mid-word?
Turn on On Word. The cut moves backward to the last whitespace before the limit (or forward to the next whitespace, when truncating from the left), so the kept text ends on a complete word. The character cap still applies; the cut just lands on a clean break.
Does anything upload?
No. The transform runs in your browser via JavaScript. Your text never leaves the page.