Text Length Limits: Platform Character Restrictions Explained
Why Text Limits Exist
Platforms enforce character limits for practical reasons. Social media feeds need to show multiple posts per screen. Search results need consistent snippet sizes. Databases need predictable storage. APIs need bounded payloads.
For you, the writer or developer, these limits are hard constraints. Exceed them and your content gets silently truncated, your form rejects the submission, or your API call fails. Knowing the exact numbers saves time and prevents frustration.
Social Media Character Limits
Social platforms define limits per field, not per account. Here is the complete breakdown:
| Platform | Field | Character Limit |
|---|---|---|
| X (Twitter) | Tweet | 280 |
| X (Twitter) | Display name | 50 |
| X (Twitter) | Bio | 160 |
| Caption | 2,200 | |
| Bio | 150 | |
| Hashtag | 30 tags max | |
| Post | 3,000 | |
| Article | 120,000 | |
| Headline | 220 | |
| About section | 2,600 | |
| Post | 63,206 | |
| Ad primary text | 125 | |
| Ad headline | 40 | |
| TikTok | Caption | 2,200 |
| TikTok | Bio | 80 |
| YouTube | Title | 100 |
| YouTube | Description | 5,000 |
| Pin description | 500 | |
| Board name | 100 | |
| Post title | 300 | |
| Post body | 40,000 | |
| Snapchat | Caption | 250 |
Practical Tips for Social Limits
- Always write under the limit. If a tweet allows 280 characters, aim for 240. Truncation markers ("...") signal rushed writing.
- Account for links. X (Twitter) reserves 23 characters for any URL, regardless of its actual length. Always test with the final shortened URL.
- Emojis cost more bytes. Adding 10 emojis to an Instagram caption does not change the character count much, but it increases byte size substantially. Some analytics tools still count bytes.
- Whitespace counts. Line breaks and spaces count toward limits. A 2,200-character Instagram caption with generous spacing might hit the wall sooner than you expect.
SEO Character Limits
Search engines do not publish hard limits, but they truncate display at predictable points:
| Field | Recommended Limit | What Happens If You Exceed It |
|---|---|---|
| Title tag | 60 characters | Google truncates with "..." |
| Meta description | 155 characters | Google truncates with "..." |
| URL slug | 75 characters | Browsers handle longer URLs, but search results may crop the display |
| URL total | 2,048 characters | Internet Explorer refuses to load longer URLs; other browsers vary |
| H1 heading | 70 characters | No truncation penalty, but overly long headings dilute keyword focus |
| Alt text | 125 characters | Screen readers process longer alt text, but conciseness improves accessibility |
Title Tag Strategy
Search engines weigh the first words in a title tag more heavily. Put your primary keyword near the beginning. If your title is "Best Project Management Tools for Small Teams in 2026," Google reads and ranks "Best Project Management Tools" more than the trailing context.
A practical formula for title tags:
[Primary Keyword] - [Differentiator] | [Brand]
Example: "Character Counter - Free Online Tool | ToolBoxes"
Meta Description Strategy
Meta descriptions do not directly affect rankings, but they strongly influence click-through rates. A compelling description under 155 characters can dramatically improve traffic from the same ranking position.
Write descriptions as ad copy, not summaries. Include a benefit and a verb.
Database and API Character Limits
Backend systems enforce limits that front-end validation must match. Mismatches cause silent truncation or server errors.
Common Database Limits
| Database | Type | Character Limit |
|---|---|---|
| MySQL | VARCHAR | Up to 65,535 bytes (shared row limit) |
| MySQL | TEXT | 65,535 bytes |
| MySQL | MEDIUMTEXT | 16,777,215 bytes |
| PostgreSQL | VARCHAR(n) | User-defined (up to ~1 GB) |
| PostgreSQL | TEXT | Unlimited (up to ~1 GB) |
| SQLite | TEXT | 1 billion bytes |
| MongoDB | String | 16 MB per document |
The critical detail: MySQL's VARCHAR counts bytes, not characters, when using multi-byte encodings. A VARCHAR(100) column with utf8mb4 can store 100 ASCII characters but only 25 four-byte emojis.
API Payload Limits
| API | Limit |
|---|---|
| REST API (typical) | 1–10 MB request body |
| GraphQL | Varies by implementation |
| AWS API Gateway | 10 MB |
| Cloudflare Workers | 100 MB |
| Stripe API | 500 KB per request |
| Twitter API v2 | 280 characters per tweet field |
Always validate input length on both client and server. Client-side validation improves UX with immediate feedback. Server-side validation prevents malicious or malformed requests from reaching your database.
Handling Character Limits in Code
Here are practical patterns for enforcing limits correctly across languages.
JavaScript: Count Unicode Characters Correctly
// Wrong: counts UTF-16 code units
text.length
// Right: counts Unicode characters
[...text].length
Python: Count Characters vs Bytes
len("😀") # 1 — Python counts characters correctly
len("😀".encode("utf-8")) # 4 — byte count for storage
Trim Text Without Breaking Words
Truncating at an exact character limit often cuts mid-word. A better approach truncates at the last space before the limit.
function truncate(text, maxChars) {
if ([...text].length <= maxChars) return text
const truncated = text.slice(0, maxChars)
const lastSpace = truncated.lastIndexOf(' ')
return truncated.slice(0, lastSpace) + '...'
}
Validate Input Length on Form Submission
Always enforce limits before sending data to the server:
<input maxlength="280" />
<p id="counter">0 / 280</p>
const input = document.querySelector('input')
const counter = document.querySelector('#counter')
input.addEventListener('input', () => {
const count = [...input.value].length
counter.textContent = `${count} / 280`
})
Pair maxlength with a live counter so users see their remaining allowance before they hit the wall.
Key Takeaways
- Social media platforms enforce strict character limits per field — always write under the limit to avoid truncation markers.
- SEO title tags should stay under 60 characters and meta descriptions under 155 characters to prevent Google from cropping your display.
- MySQL VARCHAR counts bytes, not characters — multi-byte characters eat into your limit faster than you might expect.
- JavaScript
.lengthcounts UTF-16 code units, not Unicode characters — use the spread operator for accurate counts. - Validate character limits on both client and server. Client-side gives instant feedback; server-side prevents database corruption.
- Trim text at word boundaries rather than at exact character positions for cleaner results.
Related Guides
Try It Yourself
Before you publish your next post, send that email, or commit your code — verify your character count. Our free tool counts characters, words, and bytes in real time so nothing gets cut off.