Skip to content
YAS.SH
Text & Data🔒 Browser (client-side)API available📴 Works offlinebeginner

String Length

Counts characters, bytes, words and lines in your text.

Data stays in your browser
Ready to runInstant execution
All tools →
Result

What does this tool do?

Counts characters, bytes, words and lines in your text.

Why would I use it?

  • You are respecting an API or SMS character limit.
  • You want to know the byte size of a UTF-8 string.
  • You are auditing content length.

Real-life example

Input
Hello, world!
Output
13 chars · 13 bytes · 2 words · 1 line

Multibyte characters count differently in bytes.

Input → Process → Output → Next

Input
Paste text.
Process
The browser counts with correct UTF-8 semantics.
Output
Character, byte, word and line counts.
Next action
Use the counts to trim or pad content.

Common mistakes

  • Counting bytes as characters for non-ASCII (é is 2 bytes).
  • Counting words with punctuation included.
  • Ignoring newlines in line counts.

What the result means

Each metric measures a different aspect of the text's size.

Privacy & security

Your input is processed entirely in your browser and never sent to a YAS server.

API

Endpoint
POST https://yas.sh/api/v1/tools/string-length
Request Header
Content-Type: application/json
cURL
curl -X POST "https://yas.sh/api/v1/tools/string-length" \
  -H "Content-Type: application/json" \
  -d '{"input":"héllo\nworld"}'
JavaScript
const res = await fetch("https://yas.sh/api/v1/tools/string-length", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
  "input": "héllo\nworld"
}),
});
const data = await res.json();
Python
import requests

r = requests.post("https://yas.sh/api/v1/tools/string-length", json={"input":"héllo\nworld"})
data = r.json()
FieldTypeRequiredDescription
inputstringYesAny text
Success response
{ "slug": "string-length", "result": { "chars": 11, "bytes": 12, "words": 2, "lines": 2 } }

Count characters (code points), bytes, words and lines.

Error responses
  • 400 VALIDATION_ERROR — invalid input or unsupported option.
  • 413 PAYLOAD_TOO_LARGE — input exceeds the 64 KB limit.
  • 429 RATE_LIMIT_EXCEEDED — rate limit exceeded (60 req/min).
Limits
  • Maximum input: 64 KB per request.
  • Rate limit: 60 requests/min per IP address.
  • Authenticated accounts benefit from higher tier quotas.
Ask YAS AI
🍪 Cookies & privacy. Essential cookies keep you signed in and remember language and theme. Google AdSense and reCAPTCHA are Google technologies: AdSense runs only after Accept All; reCAPTCHA loads on sign-in and contact forms. See how Google uses data: https://policies.google.com/technologies/partner-sites cookie policy · privacy policy.
Settings