{{ result }}
ℹ️ About Text Trimmer
Text Trimmer removes unwanted whitespace, empty lines, and optional custom characters from pasted text. It is useful for cleaning copied terminal output, normalizing lists, preparing data for import, and removing accidental leading or trailing spaces without changing the intended content.
Common use cases:
- Remove leading/trailing spaces from lines
- Clean up code formatting and indentation
- Remove empty lines from text documents
- Strip unwanted characters from data files
- Prepare text for processing or import
- Clean up copy-pasted content with extra spacing
Trimming options:
- Both sides: Remove whitespace from the beginning and end of each line.
- Left/leading: Remove whitespace only from the start of each line.
- Right/trailing: Remove whitespace only from the end of each line.
- All whitespace: Remove whitespace characters throughout the text.
- Empty lines: Remove lines that contain no visible content.
- Custom characters: Remove specific characters in addition to whitespace.
Reference behavior: Browser and JavaScript environments define string trimming in ECMAScript String.prototype.trim, with the relevant whitespace code points described in the ECMAScript lexical grammar. This tool extends that idea with per-line cleanup, empty-line removal, and custom character removal.
Limitations: Aggressive whitespace removal can change code, Markdown, YAML, Makefiles, fixed-width tables, and other formats where spaces are meaningful. Preview the output before replacing source text.
API Usage Example:
POST /api/tools/text/text-trimmer
Content-Type: application/json
{
"text": " hello ",
"trimType": "both",
"trimWhitespace": true,
"trimEmptyLines": false,
"customCharacters": "",
"preserveIndentation": false
}