The Developer Text Utilities Cheatsheet: Word Count, Case Conversion, and More
From counting characters to sorting lines and checking readability - here are the text utilities every developer should have bookmarked, with quick-reference examples.
Every developer works with text. Strings, payloads, code snippets, UI copy, log output - it is all text. And yet most developers end up writing one-off scripts to do things a good text utility could handle in milliseconds.
This cheatsheet covers the five text utilities you will reach for repeatedly: word counter, character counter, case converter, text sorter, and readability scorer. Bookmark it. Share it with your team.
Word Counter - /tools/word-counter
Counting words sounds trivial until you are writing API documentation, a changelog, or a pull request description with a strict word limit.
// Native approach
const text = "The quick brown fox jumps over the lazy dog.";
const wordCount = text.trim().split(/\s+/).length;
// โ 9
// With punctuation stripped
const cleanText = text.replace(/[^\w\s]/g, '');
const cleanWordCount = cleanText.trim().split(/\s+/).length;
// โ 8
Common use cases:
- Documentation with word count requirements
- Abstract submissions with upper limits
- Code comment length checks in code reviews
- SEO meta description length (characters, not words - see below)
Quick reference:
| Metric | Example |
|---|---|
| Words | text.split(/\s+/).filter(Boolean).length |
| Unique words | new Set(text.toLowerCase().match(/\b\w+\b/g)).size |
| Sentences | text.split(/[.!?]+/).filter(Boolean).length |
| Paragraphs | text.split(/\n\n+/).filter(Boolean).length |
For a full breakdown - word count, sentence count, paragraph count, and reading time estimate - use Toolblip's Word Counter. No signup, no upload, everything runs in your browser.
Character Counter - /tools/character-counter
Character count matters in places developers often forget: Twitter (280), SMS (160), database column limits, URL length constraints, and UI components with fixed-width labels.
const text = "Hello, world!";
// With spaces
text.length;
// โ 13
// Without spaces
text.replace(/\s/g, '').length;
// โ 11
// Unicode-safe (accounts for emoji, CJK chars)
[...text].length;
// โ 13 (same here, but matters for multi-byte chars)
const tweet = "Just shipped a new feature! ๐";
tweet.length; // โ 31 (code units)
[...tweet].length; // โ 29 (actual characters, emoji = 2 code units)
Where character limits bite you:
| Context | Typical Limit | Notes |
|---|---|---|
| Twitter/X post | 280 chars | Counts emoji as 2 |
| SMS segment | 160 chars | UCS-2 encoding |
| URL query string | ~2000 | Browser/server dependent |
| Database VARCHAR | Varies | Check your schema |
| UI label | Design-dependent | Test with real content |
Toolblip's Character Counter gives you total characters, characters without spaces, and a live Twitter-length preview.
Case Converter - /tools/case-converter
Changing text case is constant - converting API responses to camelCase, snake_case for database columns, kebab-case for CSS classes, CONSTANT_CASE for config files.
const text = "hello_world";
// camelCase: first word lowercase, rest capitalized
const camel = text.replace(/_([a-z])/g, (_, c) => c.toUpperCase());
// โ "helloWorld"
// PascalCase: every word capitalized
const pascal = text
.split('_')
.map(w => w.charAt(0).toUpperCase() + w.slice(1))
.join('');
// โ "HelloWorld"
// kebab-case: replace underscores with hyphens
const kebab = text.replace(/_/g, '-');
// โ "hello-world"
// snake_case: already here, but invert kebab to snake
const snake = kebab.replace(/-/g, '_');
// โ "hello_world"
// CONSTANT_CASE: uppercase with underscores
const constant = text.toUpperCase();
// โ "HELLO_WORLD"
// Train-Case: capitalize words, hyphen-separated
const train = text
.split('_')
.map(w => w.charAt(0).toUpperCase() + w.slice(1))
.join('-');
// โ "Hello-World"
When you need it in real code:
// Converting API response keys to camelCase (recursively)
function toCamelCase(str) {
return str.replace(/_([a-z])/g, (_, c) => c.toUpperCase());
}
function keysToCamel(obj) {
if (Array.isArray(obj)) return obj.map(keysToCamel);
if (obj && typeof obj === 'object') {
return Object.fromEntries(
Object.entries(obj).map(([k, v]) => [
toCamel(k),
keysToCamel(v)
])
);
}
return obj;
}
keysToCamel({ user_name: "Alice", user_address: { zip_code: "10001" } });
// โ { userName: "Alice", userAddress: { zipCode: "10001" } }
For instant conversions without writing helper functions, use Toolblip's Case Converter. Handles camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, and more in a single interface.
Text Sorter - /tools/text-sorter
Sorting lines of text comes up more often than you expect: organizing import statements, sorting a list of environment variable names, arranging feature flags, deduplicating and ordering a list.
const lines = [
"zebra",
"apple",
"mango",
"banana"
];
// Alphabetical (A-Z)
lines.sort();
// โ ["apple", "banana", "mango", "zebra"]
// Reverse alphabetical (Z-A)
lines.sort().reverse();
// โ ["zebra", "mango", "banana", "apple"]
// Case-insensitive sort
lines.sort((a, b) => a.localeCompare(b));
// โ ["apple", "banana", "mango", "zebra"]
// Numeric sort (when lines contain numbers)
const versions = ["v1.10", "v1.2", "v1.9", "v2.0"];
versions.sort((a, b) => a.localeCompare(b, undefined, { numeric: true }));
// โ ["v1.2", "v1.9", "v1.10", "v2.0"]
// Randomize (Fisher-Yates shuffle)
function shuffle(arr) {
const a = [...arr];
for (let i = a.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[a[i], a[j]] = [a[j], a[i]];
}
return a;
}
Sorting lines vs. sorting arrays - in JavaScript, Array.sort() sorts alphabetically by default, which can produce unexpected results with numbers:
// Default sort (string comparison)
[1, 10, 2].sort();
// โ [1, 10, 2] โ "10" comes before "2" alphabetically!
// Numeric sort
[1, 10, 2].sort((a, b) => a - b);
// โ [1, 2, 10] โ correct
Toolblip's Text Sorter handles alphabetical, reverse, case-insensitive, numeric, and random sort - plus remove duplicate lines in one click.
Readability Score - /tools/readability-score
Readability scores estimate how easy your text is to read based on sentence length, syllable count, and word complexity. If you write docs, error messages, API descriptions, or any user-facing copy, these scores help you catch when your writing gets too dense.
// Flesch Reading Ease (0โ100, higher = easier)
// Formula simplified for estimation:
function fleschReadingEase(text) {
const sentences = text.split(/[.!?]+/).filter(Boolean);
const words = text.split(/\s+/).filter(Boolean);
const syllables = words.reduce((sum, w) => sum + countSyllables(w), 0);
if (!sentences.length || !words.length) return 0;
const avgWordsPerSentence = words.length / sentences.length;
const avgSyllablesPerWord = syllables / words.length;
// Classic Flesch formula
return 206.835 - (1.015 * avgWordsPerSentence) - (84.6 * avgSyllablesPerWord);
}
function countSyllables(word) {
word = word.toLowerCase().replace(/[^a-z]/g, '');
if (!word.length) return 0;
// Rough heuristic: vowel groups = syllables
const vowelGroups = word.match(/[aeiouy]+/g);
if (!vowelGroups) return 1;
// Subtract silent 'e' at end
let count = vowelGroups.length;
if (word.endsWith('e') && count > 1) count--;
return count;
}
fleschReadingEase("The quick brown fox jumps over the lazy dog.");
// โ ~82 (fairly easy)
Score interpretation (Flesch Reading Ease):
| Score | Readability | Example |
|---|---|---|
| 90โ100 | Very easy | Children's books |
| 80โ89 | Easy | Simple content |
| 70โ79 | Fairly easy | Conversational |
| 60โ69 | Standard | General writing |
| 50โ59 | Fairly difficult | Professional |
| 30โ49 | Difficult | Academic |
| 0โ29 | Very difficult | Legal/technical |
For user-facing developer content (docs, README, error messages), aim for 60โ80. For internal technical docs, 50โ70 is fine.
Toolblip's Readability Score gives you Flesch Reading Ease, Flesch-Kincaid Grade Level, and a syllable count breakdown - all in-browser.
Quick Reference Table
| Utility | What it measures | Best tool |
|---|---|---|
| Word Counter | Word, sentence, paragraph count | In-browser, instant |
| Character Counter | Characters with/without spaces, Twitter preview | In-browser, instant |
| Case Converter | camelCase, snake_case, kebab-case, etc. | In-browser, instant |
| Text Sorter | Sort, reverse, randomize, deduplicate lines | In-browser, instant |
| Readability Score | Flesch scores, grade level, syllable count | In-browser, instant |
All five tools run entirely in your browser. No data is sent to any server - which matters when you are working with proprietary copy, internal documentation, or anything you would rather not upload.
Put It Together
These utilities shine when chained together:
- Paste draft documentation into Character Counter to check meta description length
- Run it through Readability Score to catch over-complex sentences
- Use Case Converter to standardize terminology
- Sort with Text Sorter and deduplicate a list of terms
- Check final word count with Word Counter
None of these require a signup. Open the tab once, keep it in your toolbar, and reach for it the next time you need to quickly count, convert, sort, or score text.
Ready to try it yourself?
Browse Free Tools โ