Tools mentioned in this article
Open the browser-based tool while you read and try the workflow immediately.
Small text tasks add up
Counting characters, removing extra spaces, checking line breaks, and escaping HTML are small tasks, but they appear constantly while writing documentation, preparing metadata, editing README files, and debugging text values.

The Text Utilities and Character Counter puts these common operations in one browser-based workflow.
Example: Tidying a meta description before publishing
When you write the description for an article or tool page, text that is too long or too short is awkward to use in search results and share cards. For example, check this description before you publish it.
A developer tool that formats and validates pasted JSON, so you can check API responses and review config files in the browser.
Check the character count in the text utilities and trim the wording if necessary. Also look for stray line breaks or extra spaces; catching them prevents layout problems when the text goes into an HTML meta tag or an OGP description.
When character counts matter
Meta descriptions, social posts, ad copy, form inputs, and database fields often have practical length limits. Checking length before publishing helps avoid truncated text and awkward layout breaks.
For table-heavy documentation, pair this with the Markdown Table Generator. For pattern extraction and validation, use the Regular Expression Tester.
Keep an original copy
Escaping, trimming, and replacing text can be hard to reverse after multiple steps. Keep the original content nearby when editing important prose, HTML, JSON, regex patterns, or code snippets.
Example: Making a code snippet safe to display in HTML
When you want to show an HTML tag example in documentation, pasting it directly can cause the browser to interpret it as a tag.
<script>alert("test")</script>
To treat it as display text, HTML-escape it before putting it in the article or description.
<script>alert("test")</script>
This is useful when reviewing places that render user input, documentation samples, or HTML fragments inside Markdown. Checking the line count and the post-conversion result in the text utilities before a bulk regex replace makes it easier to notice unintended changes.
Watch out for invisible characters
The trickiest problems in text handling are characters you cannot see but that still affect behavior. Knowing the common ones reduces mysterious bugs.
- Trailing whitespace: it shows up as noise in a diff, and in Markdown two trailing spaces become an unintended line break.
- Full-width spaces (
): mixed in when you meant a half-width space, they cause misaligned indentation in code and parse errors in YAML. - Zero-width characters and BOM: they slip in when you copy and paste, and make string comparisons and searches fail to match.
- Line-ending differences (CRLF / LF): across operating systems they can make every line show up in a diff.
When something “looks identical but does not match” or a diff looks oddly large, first clean up whitespace and invisible characters, then check that the character and line counts are what you expect. That narrows the cause much faster.
How counting and conversion actually work
You can check how the text utilities tool counts from real input.
| Input | Chars | Lines | Words | Bytes |
|---|---|---|---|---|
Hello World |
11 | 1 | 2 | 11 |
こんにちは |
5 | 1 | 1 | 15 |
😀 |
2 | 1 | 1 | 4 |
é (made of e plus a combining accent, 2 characters) |
2 | 1 | 1 | 3 |
Two lines, a and b (with a trailing newline too) |
4 | 3 | 2 | 4 |
two spaces (spaces before and after) |
14 | 1 | 2 | 14 |
- Characters are counted in UTF-16 units. An emoji counts as 2, and an
ébuilt from a combining accent also counts as 2. The number can differ from a service that counts a limit in “visible characters”. - Lines are counted by splitting on newlines, so a trailing newline adds one more line.
- Words are runs separated by whitespace. Japanese has no spaces, so a whole sentence counts as one word.
- Bytes are counted in UTF-8: 3 bytes per Japanese character and 4 for an emoji. Use it when a database column or API limit is specified in bytes.
- Spaces and newlines count as characters (leading and trailing spaces included).
HTML escaping converts five characters: & < > " ' (' becomes '). Unescaping handles only the same five, so other entities such as or © are left as they are.
Summary
Text cleanup is not glamorous, but it keeps documentation, metadata, and code examples reliable. A single place for counts and transformations makes the workflow faster and less error-prone.
Frequently Asked Questions
Does the character count distinguish full-width and half-width characters?
The Text Utilities and Character Counter reports character and line counts. For meta description or social post limits, appearance varies with full-width/half-width characters and line breaks, so the most reliable approach is to paste the exact string you’ll use and check it.
When do I need HTML escaping?
When you render user input directly on screen, or include an HTML tag example in documentation. Converting < > & " to entities prevents the browser from interpreting them as tags, so they display as literal text. It’s also a basic defense against XSS.
Is the text I enter sent anywhere?
No. Character counting, escaping, and whitespace cleanup all run in your browser and never send your input to a server, so it’s safe even for internal documents or unpublished drafts.
Why does text that looks identical not match?
Usually the cause is an invisible character: a full-width versus half-width space, a zero-width character, a BOM, or a CRLF versus LF line ending. When a string comparison or search fails to match, clean up the whitespace and count the characters and lines to compare. That makes it easier to notice the hidden character that got in.
