Tools / Text Truncate & Pad

Text Truncate & Pad.

Cut text to a maximum length with an ellipsis, or pad it to a fixed width on the left, right or both sides.

Runs in your browser

fit = truncate when longer, pad the end when shorter

Ctrl/⌘ + Enter to run · Ctrl/⌘ + Shift + C to copy the result

Result
Result
Stats

About Text Truncate & Pad

Truncate & Pad prepares text for places with a fixed size: card titles, meta descriptions, SMS messages, database columns, fixed-width reports and console tables. In truncate mode every line longer than the limit is cut and finished with an ellipsis, and the ellipsis counts towards the limit, so a thirty-character limit really produces at most thirty characters. Turn on word boundaries to avoid chopping a word in half; the cut then moves back to the last space and trailing spaces are removed. The pad modes do the opposite and extend short lines to the target length, at the end for left-aligned columns, at the start for right-aligned numbers, or on both sides to centre text. The padding can be any character or sequence, so 42 padded with zeros to five characters becomes 00042, and dots make a classic table-of-contents leader. Fit mode combines both, which is the quickest way to build aligned plain-text columns. Lengths are measured in Unicode code points, so Cyrillic letters and most emoji count as one character, unlike in many programming languages. A frequent mistake is assuming a database limit counts characters when it counts bytes; check your column type. Lines are processed separately unless you switch that off, and nothing leaves your browser.

How to Use

  1. Paste the text, one value per line.
  2. Choose truncate, pad or fit and set the length.
  3. Adjust the ellipsis or padding characters and copy the result.

Frequently Asked Questions

Does the ellipsis count towards the limit?

Yes. With a limit of 20 and the single-character ellipsis …, the text keeps 19 characters plus the ellipsis. Use three dots if the target cannot display the … character.

How is length measured?

In Unicode code points. Letters with accents written as one character, Cyrillic letters and most emoji count as one; emoji made of several code points count as several.

Can I pad with more than one character?

Yes. The pattern is repeated and cut to fit, so ".-" padding 5 characters gives ".-.-.".

Is my text uploaded?

No. The tool runs in your browser.

Related Tools