Count list items
apples, bananas, an empty row and cherries make 3 items, even though the paste spans 5 lines: blank spacer rows are skipped by default. Count shopping lists, packing lists, rosters or ticket backlogs with one item per line. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Text
- apples bananas cherries
- Quantity
- 3
- Item count
- 3
- Total lines
- 5
- Blank lines
- 2
Counting list items is a daily inventory task: paste a shopping list, a packing checklist, a roster of names, or a backlog of tickets and learn how many rows actually matter. This list item counter accepts non-empty text with one entry per line, splits on carriage return, line feed, or CRLF pairs, then returns a stable item count. By default blank and whitespace-only lines are ignored so spacer rows do not inflate your inventory; turn that option off when every line segment—including trailing empties—should count.
What counting list items means and how blank lines are treated
A list-item count answers a search intent different from a generic line counter: how many entries are in my list, how many products, names, or tasks appear one per line, and whether blank spacer rows should be excluded for inventory validation. This capability defines an item as a line segment between line terminators. Terminators are carriage return, line feed, or the Windows-style carriage-return-plus-line-feed pair treated as a single break so a CRLF file is not double-counted.
After splitting, each segment is classified. A line is non-blank when trim removes all leading and trailing whitespace and something remains—letters, digits, punctuation, or other visible characters. A line is blank when the segment is empty or becomes empty after trim, which covers pure spaces, tabs, and completely empty rows between blocks.
Prefer this count-list-items calculator when the search intent is count list items, how many items in my list, or list inventory counter online. Do not use it when you need word counts, character counts as the primary product promise, paragraph detection, or full multi-field line statistics as a separate landing—those are different terms.
What you can do with it
Shopping and packing inventory
Paste a shopping or packing list one item per line and get an item count that ignores blank spacer rows by default.
Roster and backlog checks
Teachers, PMs, and support teams count names or tickets in paste-bin lists without installing local shell utilities.
FAQ
What happens if text is empty?
A zero-length string is rejected and not charged; whitespace-only non-empty text is allowed and may report count zero when blanks are ignored.
Is the list item counter free?
The browser tool runs free on your device.
How are CRLF and LF handled?
Carriage return, line feed, and CRLF pairs are all treated as line breaks. CRLF counts as a single break so Windows-style lists are not double-counted.
Why does my list show more lines than items?
Because blank rows are skipped by default. The sample with apples, bananas, an empty row and cherries spans 5 lines, but only 3 of them hold an item, so the count is 3.
How do I count blank lines as items too?
Turn off the option that ignores blank lines. Then every line counts, including empty rows and the one after a final line break, so the same sample gives 5 instead of 3.
Related tools
For developers — API access
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.
API endpoint
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.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/str/count-list-items \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"apples\nbananas\n\ncherries\n"}'const res = await fetch("https://api.kit.forhosting.com/str/count-list-items", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"text": "apples\nbananas\n\ncherries\n"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/str/count-list-items",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"text": "apples\nbananas\n\ncherries\n"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/str/count-list-items", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"text":"apples\\nbananas\\n\\ncherries\\n"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"text":"apples\nbananas\n\ncherries\n"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/str/count-list-items", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"text": "apples\nbananas\n\ncherries\n"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "str.count_list_items",
"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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Empty input fails with invalid input so pipelines never store zero-length payloads by accident.
What counting list items means and how blank lines are treated
The primary field count (also exposed as item_count) equals non_blank_lines when ignore_blank is true, and equals total_lines when ignore_blank is false. That single switch is the product promise: quick inventory that matches how people think about lists, not how editors expose trailing newlines.
Input contract, ignore_blank option, and reading the response fields
Send a JSON body with the required string field text set to the non-empty list you want measured. Aliases input, value, s, content, body, and list are accepted when older clients or form generators use those names. Optional ignore_blank defaults to true; aliases skip_blank, skip_empty, and ignore_empty map to the same flag. Boolean values work directly; common string forms true false yes no on off and numeric zero or one are also accepted so form posts and query-style clients stay simple. Missing text, a non-string value, or a zero-length string all raise invalid_input with a message that names the problem, and those failures are not charged on the prepaid API. Whitespace-only text is allowed when it is not zero-length: with the default ignore_blank it reports count zero and blank_lines equal to total_lines, which is the correct inventory result for a list that contains no real items. On success the response includes count and item_count as the inventory total under the current option, total_lines as every line segment, blank_lines and non_blank_lines for audit, ignore_blank echoing the setting used, character_count as the UTF-16 length of the original string, original echoing the exact input for UI tables, and method always count_list_items so downstream code can branch without sniffing shapes. Use count alone when a badge only needs how many items exist; use blank_lines when a style check cares about empty spacer rows between blocks; set ignore_blank false when a trailing newline must increase the count to match a strict line-oriented protocol. Keep payloads to ordinary message and document sizes suitable for a Worker isolate rather than multi-megabyte dumps; this product is a text utility for lists, not a bulk file warehouse.
API usage, pricing, workflows, and practical limits
Call the free in-browser count list items tool for shopping lists, packing checklists, classroom rosters, sprint backlogs, and paste-bin audits without installing wc or writing a script in every language. A typical workflow pastes a draft packing list, counts items with blanks ignored, then compares against a packing target before travel. Use the prepaid KIT API when a CMS, content pipeline, QA harness, or mobile client needs the same contract under balance at $0.002 per successful item; validation failures never consume balance after the engine rejects the request. Pair this endpoint with sort or unique-word tools when the next step is cleaning the list, but keep count list items as its own landing so the count-list-items search intent is not mixed with generic line statistics or word frequency. Do not expect CSV column parsing, JSON array length, or bullet-marker stripping—those are separate problems with separate SEO terms. Authors shipping SDKs can document text as the only required field, show ignore_blank defaulting to true, and ship a multi-line success example plus an empty-string error example so integrators see both sides of the contract.
Integration use cases
CI fixtures for list pipelines
Build scripts pin list-item golden outputs so CRLF mishandling or empty-input regressions fail continuous integration immediately.
Technical questions
How do I count list items with this tool?
Send JSON with text set to your non-empty list (one item per line). The response returns count and item_count, plus total_lines, blank_lines, and non_blank_lines.
What does ignore_blank do?
When true (the default), empty or whitespace-only lines are not counted as items. When false, every line segment counts, including trailing blank rows after a final newline.