Try the Text Truncator

Text Truncator β€” Shorten Any Text to a Set Character or Word Limit

Learn how smart text truncation works, why word boundary cuts matter, how to account for ellipsis length, and how to use a free text truncator for meta descriptions, database fields, and notification previews.

By sadiqbd Β· June 6, 2026

Text Truncator β€” Shorten Any Text to a Set Character or Word Limit

Text that runs too long needs to be cut β€” but where and how you cut matters

Database fields have character limits. API endpoints return descriptions that need to fit in a fixed-width UI. SEO meta descriptions get truncated by Google at around 160 characters. Social media platforms impose hard limits on post length. Mobile notification previews show a certain number of characters. Tweet length is 280. SMS is 160.

In all of these contexts, you need to truncate text to a specific length β€” and doing it thoughtfully (cutting at word boundaries, adding an ellipsis) produces readable results rather than broken mid-word strings.


Why Truncation Is More Complex Than Cutting to N Characters

Naive truncation cuts at exactly N characters:

"Hello, this is a sample text for truncation" truncated to 20 characters: "Hello, this is a sam" ← cuts mid-word, awkward

Intelligent truncation cuts at the nearest word boundary: "Hello, this is a" + "..." = "Hello, this is a..." ← clean

The difference between these two approaches determines whether the truncated result reads naturally or looks like a broken fragment.


Truncation Modes

By character count

The most common requirement β€” limits the total characters to a specified maximum.

  • Naive: cut at exactly N
  • Smart: cut at the last word boundary before N, add ellipsis

By word count

Limits the output to a specified number of words. "The quick brown fox jumps over the lazy dog" truncated to 4 words: "The quick brown fox..." or "The quick brown fox" (without ellipsis)

By sentence count

Limits the output to N sentences. Useful for extracting the first paragraph or a snippet. First 2 sentences of a paragraph, rest omitted.

By line count

For multi-line text, keeps only the first N lines.


How to Use the Text Truncator on sadiqbd.com

  1. Paste your text β€” the content to truncate
  2. Set the limit β€” number of characters, words, sentences, or lines
  3. Configure options:
    • Smart truncation (word boundary) vs. hard cut
    • Include ellipsis (...) or not
    • Preserve HTML or strip it (for HTML content)
  4. Truncate β€” the shortened text appears instantly
  5. Copy β€” ready to use in your application

Real-World Examples

Meta description trimming

A blog post excerpt is 280 characters. Google's meta description limit is ~160 characters. Truncating at 160 characters with word boundary:

Original: "Learn how compound interest works, what the formula means in practice, how different compounding frequencies affect your returns, and how to use a free compound interest calculator to see your exact maturity amount before you invest."

Truncated to 160 chars at word boundary: "Learn how compound interest works, what the formula means in practice, how different compounding frequencies affect your returns, and how to use a free..."

157 characters β€” fits within the limit, cuts cleanly between words.

Social media post trimming

A prepared statement needs to fit in a tweet (280 characters). The raw text is 350 characters. Truncate to 277 characters (leaving room for ...) at word boundary, add ..., total 280.

Database field limits

A description field in a database accepts maximum 255 characters. User input is being validated before insertion. Truncate at 255 characters with word boundary to ensure no data is cut in a confusing way.

Notification preview text

A mobile push notification preview shows the first 100 characters of a message body. The notification system automatically truncates β€” but previewing what users will see requires the same truncation logic. Paste the full message, truncate to 100 characters, see the preview.

E-commerce product card excerpts

A product catalogue shows a 120-character description on product cards. Each product's full description (often 500–1,000 characters) needs to be truncated for the card view. Smart truncation at 120 characters produces clean card text from any description length.


Ellipsis Handling

The truncation ellipsis has two common forms:

Three periods (...): Widely supported, universally understood. Can be slightly wide in proportional fonts.

Ellipsis character (…): A single Unicode character (U+2026). Takes up less space than three periods. Preferable for display text where the character count is tight.

The ellipsis vs. "read more" pattern: Some UIs use "... read more" or a truncated text followed by a clickable expansion. The truncator provides the truncated text; the UI handles the interaction.


Truncating HTML Content

If the input contains HTML markup, naive character truncation can break HTML tags β€” cutting <strong>text</strong> in the middle of the opening tag.

Smart HTML-aware truncation:

  1. Strips tags before counting characters (so only visible text is counted toward the limit)
  2. Or truncates text while closing any open HTML tags properly

The distinction matters when:

  • You're displaying excerpts from HTML-formatted blog posts
  • The source content uses bold, italic, or links that should be preserved or cleanly stripped

Most simple text truncators work on plain text. If your content is HTML, either strip the HTML first (with an HTML stripper) or use a library that handles HTML-aware truncation.


CSS Text Truncation vs. Server-Side Truncation

CSS offers text-overflow: ellipsis β€” a pure client-side truncation:

.truncated {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

This truncates text visually in the browser without modifying the underlying string. The full text is still in the DOM (accessible to search engines and screen readers).

Server-side truncation actually shortens the string. Use CSS for visual truncation in UI; use server-side truncation when the shortened string needs to be stored (database), transmitted (API response), or guaranteed to fit (Twitter, SMS, email subject lines).


Tips for Text Truncation

Always use word boundary truncation for display text. Mid-word cuts look broken. The extra few characters to find the previous word boundary are worth it.

Account for the ellipsis length. A limit of 160 characters with a 3-character ellipsis means your text should be truncated to 157 characters before appending .... Failing to account for this produces output that exceeds the limit.

Test with edge cases. Very short text (shorter than the limit β€” no truncation needed). Text with a single very long word (no word boundary available). Text with HTML. Text in other languages with different word spacing patterns.

Be consistent in your application. If product cards use 120-character descriptions, truncate all descriptions at 120 characters β€” don't mix truncated and full descriptions in the same view.


Frequently Asked Questions

Should I truncate to the limit or to the limit minus the ellipsis length? To the limit minus the ellipsis length. If the limit is 100 characters and your ellipsis is ... (3 characters), truncate the text to 97 characters before appending the ellipsis β€” final string is exactly 100 characters.

What if the text is shorter than the limit? No truncation needed β€” return the original text as-is, without appending an ellipsis.

Is character count the same as byte count? For ASCII text, yes. For Unicode (including Bangla, Arabic, Chinese, emoji), characters may be 2–4 bytes. Most display-related limits (Twitter, SMS) use Unicode character count, not byte count. Database fields may use either depending on the charset.

Can I truncate to display width rather than character count? Not easily in a plain text tool β€” display width depends on font, size, and rendering. CSS text-overflow handles display-width truncation; character count is for storage and API limits.

Is the text truncator free? Yes β€” completely free, no sign-up needed.


Text truncation is the kind of feature that seems trivial until you encounter a mid-word cut in a product description or a meta description that runs long in search results. The truncator does it cleanly.

Try the Text Truncator free at sadiqbd.com β€” truncate any text to any length with smart word-boundary cutting and ellipsis.

Try the related tool:
Open Text Truncator

More Text Truncator articles