Skip to content
UniKit

Text truncate

Truncate text by characters, UTF-8 bytes or words — from the end, the start or the middle — with an ellipsis, without splitting English words or multi-byte characters, and with the exact removed length reported.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

Original text
Count by
Cut from

Truncated output

Emoji and combining marks each count as a single character.

Type or paste text to see the truncated result instantly.

What this tool does

  • Write list-page summaries: cut a long description to 80 characters with an ellipsis, without leaving half a Chinese character behind.
  • Validate truncation for length-limited fields (database columns, SMS, meta descriptions) by counting UTF-8 bytes instead of characters.
  • Byte-based truncation never splits a CJK character or an emoji, so you avoid replacement characters and broken rendering.
  • Cut from the middle to keep both ends, turning a long URL or file path into https://example.com/…/report.pdf.

Example

Input

The quick brown fox jumps over the lazy dog

Output

The quick brown…

Keep 20 characters, cut from the end: the ellipsis takes one character and words are never split, so the result stops at “The quick brown” (15 characters) plus the ellipsis.

Frequently asked questions

Does truncating by characters break emoji or accented letters?

No. Characters are counted as Unicode grapheme clusters: surrogate pairs (👍), skin-tone modifiers (👍🏽), combining marks (e + U+0301) and ZWJ sequences (👨‍👩‍👧) all count as one character, and the cut always lands on a cluster boundary.

Why is a byte-based result shorter than the limit I set?

A Chinese character takes 3 bytes and an emoji up to 4, and the tool stops at a grapheme boundary instead of cutting a character in half, so the real size can be below the limit. The ellipsis takes 3 bytes by default as well — turn “Ellipsis counts toward the limit” off when you need the exact cap.

Why is the result shorter than the limit?

English words are kept whole by default: if the cut would land inside a word, the tool backs off to the previous space. Trailing whitespace is dropped too. Enable “Allow cutting English words” when you need to hit the limit exactly.

How is the removed length calculated?

It counts what was dropped in the current unit and never includes the ellipsis: characters, UTF-8 bytes or words. When the input is within the limit the removed length is 0.

What does middle truncation keep?

The head comes first: half the budget goes to the beginning and the rest to the end, so keeping 6 characters of abcdefghij gives abc…ij. Both edges still respect the “never split a word” rule.

Keywords:truncate textcut stringutf-8 byteslimit charactersellipsis文本截断截取字符串按字节截断省略号不切断单词

Related tools