Text length filter
Filter a text list by Unicode code-point length.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Filtered result
Matching lines in their original order, one per line.
Enter a text list to see the result
Input lines: 0 · Matched: 0 · Removed: 0
What this tool does
- Clean a list pasted from a spreadsheet or log by dropping rows that are too long (or too short) — keep only entries of 2–6 characters, for instance.
- Pre-process data for a bulk import: strip empty lines and over-long descriptions, then feed the rest to the next tool.
- Filter short Chinese sentences by character count: length is measured in Unicode code points, so a Han character counts as 1 instead of 3 bytes.
Example
Input
a bb ccc
Output
bb ccc
The example uses minimum length 2 and maximum length 3 (the two fields in the form), which drops the single-character line a. Output keeps the original order, one line each, after trimming.
Frequently asked questions
How is the length counted?
In Unicode code points (Array.from(line).length). A Han character or an emoji counts as one, unlike a byte count where one Han character takes three UTF-8 bytes. Use the byte counter tool when you need the byte length.
What happens to blank lines and spaces?
Every line is trimmed first and blank lines are dropped entirely, so they never appear in the result and are not length-filtered. The input "a\n\nbb" is therefore treated as the two lines a and bb.
What if nothing matches?
The result is an empty string with matched = 0 and removed equal to the number of input lines; that is not an error. Real errors are: empty or whitespace-only input, a negative minimum, a maximum smaller than the minimum, or more than 100000 lines.
How many lines can it handle?
Up to 100000 lines per run; more than that reports the input as too large. The maximum length filter accepts values up to 1000000, which normal text never reaches.
Keywords:Text length filterstr-filtertextlist