String Length Calculator

计算字符数、字节数(UTF-8/ASCII)、单词数和行数。

状态
字符(Unicode) 0
字节(UTF-8) 0
字节(ASCII/多字节) 0
单词 0
0
空格 0
字符分解
ASCII: 0
非ASCII: 0
数字: 0
What is String Length?

String length can be measured in different ways: character count (visual units), byte count (storage size), codepoint count (Unicode units), or grapheme count (user-perceived characters). Understanding these distinctions is crucial when working with international text, databases with size limits, or APIs with character restrictions.

Length Metrics Explained

Character count varies by encoding: an emoji might be 1 character visually but 4 bytes in UTF-8. Word count typically splits on whitespace. Line count depends on newline characters. Byte count reflects actual storage size and varies with encoding (UTF-8, UTF-16, etc.).

Cron 解析器
  • Checking text length for Twitter/SMS limits
  • Validating database field constraints
  • Estimating reading time for articles
  • Analyzing document statistics
  • API payload size estimation
Metrics Provided
字符 (Unicode) Total character count including spaces
字符 (Unicode) Character count excluding whitespace
单词 Count of space-separated words
Number of line breaks + 1
Bytes UTF-8 encoded byte size
Frequently Asked Questions

Why does emoji length vary?

Emojis can be composed of multiple Unicode codepoints. A family emoji might be several characters joined by Zero-Width Joiners. Different systems count these differently.

What encoding is used for byte count?

This tool uses UTF-8, the most common web encoding. UTF-8 uses 1-4 bytes per character: ASCII uses 1 byte, most other languages use 2-3 bytes, and emojis use 4 bytes.