String Length Counter

Charactersβ€”
Characters (no spaces)β€”
Wordsβ€”
Linesβ€”
UTF-8 bytesβ€”

How String Length Counter is calculated: Characters = code points including spaces; words = text split on whitespace; lines = non-empty lines; bytes = UTF-8 encoded length.

What is a string length counter?

A string length counter tells you how long a piece of text is β€” in characters, in words, in lines, and in UTF-8 bytes. The default text on this page, The quick brown fox jumps over the lazy dog., has 44 characters, 36 characters without spaces, 9 words, 1 line, and 44 bytes, because every character in it is plain ASCII. Paste in any text and every number updates live as you type.

The need comes up everywhere text has a limit. A social media post allows 280 characters. A text message allows 160. A database column allows 255. A username allows 30. In each case, the writer needs a number, not a guess β€” and counting by hand is slow, boring, and wrong, especially when the text has emoji or accented letters in it.

This counter covers the numbers people actually check: characters with spaces, characters without spaces, words, lines, and UTF-8 bytes. Everything runs in your browser β€” your text never leaves your device, nothing is stored, and there is no account to create. A character counter counts characters for the same text, and a word counter adds sentences, paragraphs, and reading time.

How a string length counter works

Counting characters sounds simple, and the basic rule is simple: count the code points. The default text has 44 characters because it has 44 code points, and every one of them is a plain letter, space, or full stop. But the edges are where counters differ, and the edges are what this page gets right.

Characters without spaces strips all whitespace first, which gives 36 for the default text β€” the 8 spaces are gone, and everything else stays. Words are counted by splitting on whitespace, which gives 9. Lines are counted by splitting on line breaks and ignoring empty ones, which gives 1 for a single line. Bytes are counted by encoding the text as UTF-8, which gives 44 for the default text, because every ASCII character is exactly one byte.

The difference between characters and bytes is the number most people get wrong. An accented letter like Γ© is 1 character but 2 bytes. An emoji like πŸ˜€ is 1 character but 4 bytes. A 280-character post full of emoji can easily be over 500 bytes, and a system that limits bytes will reject it while a system that limits characters accepts it. This counter shows both numbers, so you can check whichever limit applies. A case converter can tidy the capitalisation of the same text once you are happy with its length.

Characters, code points, and bytes β€” the counts people get wrong

The most misunderstood count is the character count itself. Most tools count UTF-16 code units, which is what JavaScript's .length gives you β€” and an emoji counts as 2 units there, not 1. This counter counts code points instead, so πŸ˜€ counts as 1 character. The test case proves it: CafΓ© πŸ˜€ has 6 characters by code points, but 7 by UTF-16 length, and 10 bytes in UTF-8. If your limit counts characters the way a human does, the code-point count is the honest one.

Bytes are the second trap. A database column that holds 255 bytes will not hold 255 emoji β€” it will hold 63, because each emoji takes 4 bytes. A form that limits a name to 50 bytes will reject a 30-character name full of accented letters. Always check whether your limit is in characters or in bytes; if it does not say, assume characters for display limits and bytes for storage limits.

Lines are the third trap. A text box that counts lines counts non-empty lines here, so a blank line between two paragraphs does not add to the count. Two paragraphs separated by a blank line count as 2 lines, not 3. If your limit is in lines β€” a poem, a form, a code comment β€” count the lines that hold text, not the gaps between them. A text formatter can clean up the spacing of the same text before you count it.

A worked example: checking a short sentence

Here is a real situation where a string length counter earns its keep. You are writing a bio with a 50-character limit, and you have drafted a sentence. Paste it in and the counter tells you exactly where you stand β€” no guessing, no manual counting.

Take the default text as a small example. It reads: The quick brown fox jumps over the lazy dog. The counter says 44 characters, 36 without spaces, 9 words, 1 line, and 44 bytes. If this were a 50-character bio, you would have 6 characters to spare; if it were a 40-character limit, you would need to cut 4.

Try a trickier one. CafΓ© πŸ˜€ has 6 characters, 5 without spaces, 2 words, 1 line, and 10 bytes. The Γ© takes 2 bytes and the emoji takes 4, so the byte count is nearly double the character count. A third example with line breaks: One, Two, and Three on three lines has 13 characters, 11 without spaces, 3 words, 3 lines, and 13 bytes. Knowing those anchors lets you estimate any text before you even paste it in.

Who uses a string length counter, and why

Developers are the biggest users. Database columns, API fields, and form validations all have length limits, and a counter is the only way to check them honestly. A developer who counts by hand wastes time and still gets it wrong on emoji; a developer who pastes the text in knows in a second β€” and knows the byte count too, which is the number the database actually enforces.

Writers and social media managers are the second group. Posts, bios, and headlines all come with character limits β€” 280 on X, 150 on an Instagram bio, 160 on a text message. A word counter tells them how long the same text is in words, and this counter tells them whether it fits the box it has to go into.

Students are the third group. Short answers, fill-in boxes, and form fields all cut off at a character count, and a counter shows exactly how much room is left. The counter on this page handles all three uses β€” paste, check, edit, check again β€” which covers ninety percent of what anyone needs.

Testers and QA engineers are a fourth group, and they use the counter to probe limits. A field that allows 255 characters should accept 255 and reject 256, and the only way to test that is to count the test string first. One paste gives the exact number, and the test is honest.

String length counter vs word counter

A string length counter measures length; a word counter measures writing. This counter shows characters, characters without spaces, words, lines, and UTF-8 bytes β€” the numbers a system enforces. A word counter shows words, characters, sentences, paragraphs, and reading time β€” the numbers a teacher or an editor cares about. The two overlap on words and characters, and they differ on everything else.

The difference matters for workflow. Count length first, then check the writing: if your bio is 6 characters over the limit, cut one word and re-count. If your essay is 50 words over, cut a sentence. Length limits are ceilings, and the byte count is the one that bites when emoji are involved β€” a 280-character post can be 500 bytes, and a byte-limited system will reject it.

Character counters are the close cousin β€” some tools count characters only, with no word, line, or byte numbers. This counter includes all of them, so it covers that job too. And a character counter answers the same question for the same text if you only want the headline number without the rest.

Common string length mistakes

The most common mistake is counting the wrong thing. A 280-character limit means characters, not bytes β€” but people check the byte count, see 500, and panic. A 255-byte column means bytes, not characters β€” but people count characters, see 200, and think they are fine. Read the limit, then pick the matching number.

Second: forgetting that emoji count double or more. An emoji is 1 character but 4 bytes, and 2 UTF-16 units. A post with 70 emoji is 70 characters but 280 bytes, and a byte-limited system will reject it. If your text has emoji in it, check the byte count, not just the character count.

Third: trusting a count that includes hidden text. Copying from a word processor can bring along footnotes, comments, and tracked changes. Paste into a plain text box first β€” or into this counter, which counts exactly what you paste and nothing else β€” and check the number before you submit.

Fourth: writing to the limit instead of to the idea. A 50-character bio that says something in 40 characters is better than one padded to 50 with filler. Use the counter to stay under the limit, not to hit it exactly. The limit is a ceiling, not a target.

How to use this string length counter

Using this string length counter is simple. Paste your text into the box, or type it directly. Every number updates live as you type β€” characters, characters without spaces, words, lines, and UTF-8 bytes. There is no button to press and no form to submit.

To check a different text, select all, delete, and paste the new one. The counts reset instantly. If your text has several lines, the line count shows the non-empty ones, so blank lines between paragraphs do not inflate it. If you are checking a bio or a post, paste the exact text, emoji included, so the byte count matches what the system will see.

Everything runs in your browser. No sign-up, no account, no data sent anywhere β€” your text never leaves your device. It works offline once the page has loaded, so you can use it on a plane, in an exam hall with no signal, or anywhere else you write. Try it with something real before you need it: paste your bio, your next post, or your username, and see the numbers. Once you have used it twice, you will never count characters by hand again.

Frequently Asked Questions

The default text β€” The quick brown fox jumps over the lazy dog. β€” has 44 characters, 36 characters without spaces, 9 words, 1 line, and 44 bytes. Every character in it is plain ASCII, so the character count and the byte count are the same. Paste your own text to count it the same way.

Yes, here. This counter counts code points, so πŸ˜€ counts as 1 character. It still takes 4 bytes in UTF-8, and 2 units in UTF-16, which is what JavaScript's .length reports. CafΓ© πŸ˜€ has 6 characters, 5 without spaces, 2 words, 1 line, and 10 bytes β€” the Γ© takes 2 bytes and the emoji takes 4.

A character is what you see; a byte is what storage sees. Plain ASCII letters are 1 byte each. Accented letters like Γ© are 2 bytes. Most emoji are 4 bytes. A 255-byte database column holds 255 ASCII letters but only 63 emoji. Check characters for display limits and bytes for storage limits.

Yes. Everything runs in your browser β€” your text is never uploaded, stored, or sent anywhere. You can use it offline once the page has loaded, and you can paste sensitive text like a password draft or a private message without worrying about who sees it.

More free tools

More calculators and utilities from Sortrun β€” free, no sign-up.