ForHosting KIT · Text & AI

Count characters

Paste Hello World and see 11 characters with spaces, 10 without and 11 UTF-8 bytes, all at once. Check headlines, bios, SMS drafts and form entries against a character or byte limit before you publish. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Text
Hello World
You get
Chars
11
Chars no spaces
10
Spaces
1
Bytes
11

This character counter measures any non-empty text string and returns three core metrics at once: the total character count including spaces, the character count after all whitespace is removed, and the UTF-8 byte length of the same string. The engine is fully deterministic: it uses the platform string length for characters, a single whitespace strip for the no-spaces total, and a standard TextEncoder pass for bytes. There are no network calls, no sampling, and no date-dependent shortcuts.

Three numbers for three kinds of limit

Paste Hello World and you get 11 characters with spaces, 10 without and 11 bytes. The first total counts everything you typed: letters, spaces, tabs, line breaks and punctuation. The second drops every kind of whitespace and counts what remains, the figure many essay checkers and form rules look at when they ignore padding. The third is the size of the text in UTF-8 bytes, the unit that matters when a database column or a system limits length in bytes rather than in visible characters.

Why a short text can still be too long

An accented letter such as é looks like one character and is counted as one, yet it takes two bytes. Emoji and some rarer symbols widen that gap further. That is how a headline that fits comfortably in an editor can still overflow a column measured in bytes, so checking both numbers before you publish avoids the surprise. A bio, an SMS draft or an ad line edited at the last minute is worth one more paste. Empty text is not reported as zero: the counter asks for some text instead, so a blank entry never passes for a valid result.

Character counting answers a simple product question: how long is this string when spaces count, when they do not, and when the wire format is UTF-8 bytes instead of visual glyphs. Total characters include every code unit in the JavaScript string, so spaces, tabs, newlines, and punctuation all add to the with-spaces total. Characters without spaces drop every Unicode whitespace match from that string and recount what remains, which is the figure many essay tools and form validators care about when they ban padding.

Accented letters such as é often stay one character while consuming two UTF-8 bytes, and emoji or non-BMP symbols can widen the gap further, so publishing both metrics prevents the classic surprise of a string that looks short in an editor but overflows a byte budget. There is no word-count or reading-time mode on this page, no silent coercion of null into an empty success, and no approximate language model estimating length.

Where character counts fit in writing, limits, and software

Students meet character limits when a prompt caps answers, when a contest form rejects over-length titles, or when a coding lab asks for string length checks before serialization. Teachers can pre-generate answer keys that show expected with-space and without-space totals without trusting opaque office macros that count differently across locales. Social and marketing teams paste headlines, bios, SMS drafts, and ad copy into a counter so they know whether a line still fits after a last-minute edit.

Support and operations teams measure noisy ticket subjects and log lines so dashboards and exporters do not blow past column limits. Pair it with uppercase, slug, or encode tools when you are building a small lab of free, deterministic text helpers for forms, CMS prep, and data hygiene.

Stay inside platform limits

Check headlines, bios, SMS drafts, and form fields against character and byte caps before you publish or submit.

What does the character counter cost?

It is free in your browser on this page.

Why is bytes sometimes larger than chars?

bytes is the UTF-8 encoding size. Accented letters, emoji, and many non-ASCII symbols use more than one byte while still counting as one or more characters.

What happens if the text is empty?

Provide a non-empty string; blank submits are not treated as a successful zero count.

Does this tool count words or reading time?

No. It only returns character counts with and without spaces, a spaces delta, and UTF-8 byte length. Use a dedicated word-count tool if you need those metrics.

Which count should I compare with a character limit?

Use the total with spaces when every keystroke counts, the total without spaces when a rule ignores padding, as many essay checkers do, and the byte count when a database column or a system measures size in bytes.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/str/char-count

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/str/char-count \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"Hello World"}'
{
  "text": "Hello World"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "str.char_count",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_chars100000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Writers, social managers, developers, and students use character counts every day to stay inside platform limits, size form fields, check payload budgets, and prepare copy that must fit a fixed box. Empty input is rejected with a clear invalid_input error so a blank form field cannot become a silent zero success.

What character counting means and what the response contains

Byte length measures the UTF-8 encoding size of the original text, which is the right unit for HTTP bodies, database columns declared in bytes, and APIs that bill or truncate by payload size rather than by rendered characters. This calculator returns the echoed text, chars, chars_no_spaces, spaces as the difference between those two counts, bytes, and the fixed method tag char_count for logs and multi-tool pipelines. The engine either builds exact integer metrics inside the supported length or rejects the request with invalid_input. Rejected cases include a missing text field, a null value, an empty string, objects and arrays that are not plain text, and any payload longer than the documented maximum character count.

How the text field is read and how counts stay reproducible

The value must be a non-empty string; finite numbers and bigints are stringified first so a bare product code typed as a number still produces a stable digit string to measure. The preferred field is text, but aliases input, string, value, content, and s are accepted so query strings, spreadsheets, and typed forms can reuse the same contract without renaming columns. Booleans, plain objects, and arrays are rejected with a clear message so a mistaken JSON body does not become the word true or an unhelpful object dump. Empty string is always invalid_input: the product promise is count characters in text, not invent a zero success for a blank submit. Length is capped at one hundred thousand characters so a runaway paste cannot monopolize a Worker; longer payloads fail with an explicit limit message rather than a truncated silent cut. Counting uses text length for chars, a global whitespace replace for chars_no_spaces, and TextEncoder for UTF-8 bytes—no network dictionary, no machine-learning model, and no locale table that could drift between hosts. Pair the free browser run on this page with the priced API when you need the identical metrics inside an automated pipeline without shipping your own length helpers.

Where character counts fit in writing, limits, and software

On this page the work runs entirely in your browser; through the API each successful count costs $0.002, failed validation is not charged, and nothing is stored after the response returns. That split—free interactive exploration and a priced, identical API—matches the rest of the KIT tier-A catalog and lets you move from a classroom demo to an automated pipeline without changing the numeric result.

Deterministic test fixtures

Generate reproducible chars, chars_no_spaces, and UTF-8 byte totals for unit tests, goldens, and CI assertions.

Payload and storage budgets

Measure UTF-8 size for API bodies, database columns, and log lines so length checks match wire format, not just editor length.

What is the difference between chars and chars_no_spaces?

chars is the full string length including spaces, tabs, and newlines. chars_no_spaces removes all Unicode whitespace first, then counts what remains.

Read the full KIT documentation →