Character CounterFree online other calculator — instant results, no sign-up

Count Unicode code points with and without whitespace.

Inputs

With whitespace
30
Without whitespace25

Sign in to save results and favorites.

About the Character Counter

The Character Counter counts the Unicode code points in your text and reports totals with and without whitespace. Use it to see how spaces, tabs, and line breaks affect text length while keeping letters, punctuation, and other non-whitespace symbols in the count.

Text
The text to measure, defaulting to “Hello world. This is a sample.”, with length measured in Unicode code points.

Formula and method

C_with = N; W = Σᵢ₌₁ᴺ w(cᵢ); C_without = N − W. For “Hello world. This is a sample.”: C_with = 30 and C_without = 30 − 5 = 25.
  • NThe total number of Unicode code points in the input text.
  • cᵢThe Unicode code point at position i in the text.
  • w(cᵢ)An indicator equal to 1 when cᵢ is recognized as whitespace and 0 otherwise.
  • WThe total number of whitespace code points.
  • C_withThe count of all code points, including whitespace.
  • C_withoutThe count of code points remaining when whitespace is excluded.

Read the input as a sequence of Unicode code points, counting each one toward the total with whitespace. Identify whitespace code points and subtract their count from that total to obtain the count without whitespace. The default text contains 30 code points, including five spaces, so the two results are 30 and 25.

Worked example

These are the calculator's starting values and the results it actually produces for them.

Inputs

  • TextHello world. This is a sample.

Results

  • With whitespace30
  • Without whitespace25

How to use the Character Counter

  1. 1Enter or paste the text you want to measure into Text.
  2. 2Keep any leading spaces, trailing spaces, tabs, or line breaks that should be included in the measurement.
  3. 3Read With whitespace for the total number of Unicode code points.
  4. 4Read Without whitespace for the total after whitespace code points are excluded.
  5. 5To check the default example, use “Hello world. This is a sample.” without the surrounding quotation marks and confirm With whitespace = 30 and Without whitespace = 25.

Reading your result

With whitespace includes every code point in the input, including punctuation and whitespace. Without whitespace excludes recognized whitespace but still includes punctuation, digits, letters, and other symbols. For the default text, With whitespace = 30 and Without whitespace = 25; the difference represents its five spaces.

Limitations

Unicode code points are not the same as visible characters, bytes, or UTF-16 code units. An emoji sequence or a letter with a combining accent can contain multiple code points while appearing as one character. Visually identical text can therefore produce different counts if its Unicode representation differs. Whitespace recognition depends on the implementation's whitespace rules; not every invisible character is necessarily whitespace. Line-ending representation can also affect the total with whitespace.

Common questions

Why does the default text produce 30 with whitespace and 25 without whitespace?+

“Hello world. This is a sample.” contains 30 Unicode code points, five of which are spaces. Excluding those spaces leaves 25 code points, including both periods.

Do punctuation marks count in Without whitespace?+

Yes. Punctuation is not whitespace, so periods, commas, quotation marks, and similar symbols remain in both totals.

Does each emoji count as one character?+

Not always. A single-code-point emoji counts once, but emojis composed of multiple code points, such as joined sequences or those with skin-tone modifiers, contribute multiple counts.

Are tabs and line breaks counted?+

They contribute to With whitespace and are excluded from Without whitespace when recognized as whitespace. A line ending represented by a carriage return followed by a line feed contains two code points rather than one.

Does the calculator save my information?+

Calculations run in your browser. While signed in, inputs and results are automatically recorded in account history; saving a result creates a separate saved record.

You might also like

Results are estimates for informational purposes and are not financial, medical or legal advice.