Result
All calculations run locally in your browser: parsing, chart, export. Disconnect the network and the page keeps working.
Facts and limits of this method
| Marks handled | , . ! ? : ; ) ] } |
|---|---|
| What gets removed | One or more spaces in a row right before the mark |
| Regular expression | /[ \t]+([,.!?:;)\]}])/g → "$1" |
| Space after the mark | Untouched — only the space before the mark is removed |
| Line breaks | Not treated as a space by this tool and never removed |
| Opening brackets | ( [ { are not in the list — a space before them is usually correct |
When it misleads you
- The tool only removes spaces and tabs directly before a punctuation mark. A line break before the mark does not count as a "space" and is left untouched — if you have "word\n.", the result stays as-is.
- Opening brackets ( [ { are deliberately excluded: a space before an opening bracket is almost always correct ("text (a note)"), so the tool leaves it alone.
- An ellipsis "…" or "..." is treated as an ordinary period — a space before it is removed the same way as before a single period.
- The tool does not add spaces that are missing after punctuation (e.g. "word,word" won't become "word, word") — that's a different tool's job.
How it is calculated
The text is scanned with a regular expression that looks for one or more whitespace characters (a regular space or a tab) immediately followed by one of , . ! ? : ; ) ] }.
Each match is replaced with just the punctuation mark, with no space before it — so "word ." becomes "word.", and "word ," (several spaces) becomes "word,".
The "spaces fixed" counter tracks how many such replacements were made — in other words, how many times a mark was preceded by an extra space before processing.
The whole text is processed at once, not line by line — line breaks and paragraphs are preserved exactly as in the source text.
Questions and answers
Will it remove the space before an opening bracket?
No, on purpose. Opening brackets ( [ { are not in the list of handled marks, because a space before them is usually correct by punctuation rules.
What happens to several spaces in a row before a mark?
All of them are removed at once — "word !" becomes "word!", not "word !" with one space left behind.
Are line breaks treated as spaces?
No. The tool only looks for spaces and tabs. If a punctuation mark starts a new line after the text, the line break is not removed.
Does it add a space after punctuation when one is missing?
No, this tool only removes extra spaces before marks. Adding missing spaces after punctuation is a job for a separate tool.
Is my text sent anywhere?
No. All processing happens in your browser; the text is never transmitted anywhere.