Word and character counter

Calculate word and character counter with clear inputs and assumptions.

Calculate word and character counter with clear inputs and assumptions.

Your inputs stay in your browser. Displayed results are rounded to a maximum of 12 significant digits.

Method and assumptions

Method version 1.0.0 · Updated

Calculate

Formula: Calculate word and character counter with clear inputs and assumptions.

Calculate word and character counter with clear inputs and assumptions.

text
Text

Results are estimates where noted and depend on the entered assumptions.

Calculate with code

These short examples use the same inputs and core calculation as this tool. Adapt validation and formatting to your application.

JavaScript
const text = "Sum Hexa";
console.log({characters: [...text].length, words: text.trim().split(/\s+/).length}); // 8 chars, 2 words
TypeScript
const text = "Sum Hexa";
const words = text.trim().split(/\s+/).length;
console.log({characters: [...text].length, words}); // 8, 2
Python
text = "Sum Hexa"
print(len(text), len(text.split()))  # 8 characters, 2 words
Java
String text = "Sum Hexa";
System.out.println(text.codePointCount(0,text.length()) + ", " + text.trim().split("\\s+").length); // 8, 2
C#
string text = "Sum Hexa";
Console.WriteLine($"{text.Length}, {text.Split(' ', StringSplitOptions.RemoveEmptyEntries).Length}"); // 8, 2