VARCHAR vs TEXT in MySQL — Which Should You Use?
VARCHAR stores variable-length strings up to a defined limit inline with the row; TEXT stores larger content, often off-page. Learn when to use each.
Published September 19, 2026
Use VARCHAR(n) for short strings with a sensible maximum (names, emails, slugs) and TEXT for long, unbounded content (articles, comments). VARCHAR can be fully indexed and is kept in the row; TEXT is stored off-page.
The concept
VARCHAR(255) stores up to 255 characters plus a length byte. The row-size limit is 65,535 bytes across all columns. TEXT holds up to 64 KB (MEDIUMTEXT 16 MB, LONGTEXT 4 GB).
TEXT columns cannot have a default value in older MySQL and need a prefix length to be indexed, and temporary tables for sorting TEXT use disk.
Quick chooser
Practical examples
Typical table
CREATE TABLE posts (
id INT PRIMARY KEY AUTO_INCREMENT,
title VARCHAR(200) NOT NULL,
slug VARCHAR(200) UNIQUE,
body MEDIUMTEXT
);Index a TEXT column
CREATE INDEX idx_body ON posts (body(100));Full-text search
ALTER TABLE posts ADD FULLTEXT(title, body);Common mistakes
- Using VARCHAR(65535) 'to be safe', hitting row-size limits.
- Using TEXT for short columns and losing easy indexes.
- Choosing utf8 instead of utf8mb4 and breaking emoji.
Key takeaways
- VARCHAR for bounded strings, TEXT for large content.
- Size VARCHAR to real needs.
- Use utf8mb4.
FAQ
Is VARCHAR(255) faster than VARCHAR(50)?
Storage is the same, but a realistic limit validates data and helps memory use in sorts.
Does TEXT hurt performance?
Only if you SELECT it unnecessarily; avoid SELECT * on tables with large TEXT columns.