How to remove spaces from the start and end of text
Sample text you can copy and try
What the Side option does
Trim text and download it as a .txt file
Features explained
Side option
Choose which side of the text to trim. The default is both.
Copy result
Copies the trimmed text to your clipboard. The button changes to Copied! when it works.
Download .txt
Saves the result as a plain text file you can open in any editor.
Load example
Fills the Input text box with sample text so you can see how the tool works first.
Clear
Resets the tool so you can start again with new text.
Works in your browser
Text is processed on the page with JavaScript. The tool's code has no step that sends your text to an API.
What can you use it for?
Cleaning pasted text
Remove stray spaces that come along when you copy text from a web page, PDF or document.
Preparing form input
Clean a name, email or code before you paste it into a form that does not accept extra spaces.
Spreadsheet and data work
Tidy text before you put it into a cell, a CSV file or a database field.
Code and configuration values
Remove extra spaces from a value or string before you use it in code or a settings file.
Editing and writing
Clean up the edges of a copied paragraph before you paste it into your own document.
Tool information
| Processing | In your browser (client-side JavaScript) |
|---|---|
| Input | Plain text typed or pasted into the Input text box |
| Main option | Side |
| Default side | both |
| Output actions | Copy result, Download .txt |
| Download format | .txt (plain text) |
| Extra buttons | Load example, Clear |
Benefits
- Remove edge spaces in one step instead of deleting them by hand
- Choose which side to trim
- Copy the result or save it as a .txt file
- Try the tool first with the built-in example
Limitations
- It works with plain text typed or pasted into the box.
- Download is available only as a .txt file.
- Trimming deals with the edges of the text. Check the Result box if you also need spaces cleaned inside the text.
- Copy anything important before you press Clear.
Your text stays in your browser
This tool processes your text on the page using JavaScript. The tool's code does not send your text to a server or API. Even so, avoid pasting passwords or other confidential text on a shared or untrusted computer.
Tips
- Leave Side on both unless you only need to clean one edge.
- Press Load example to see how the tool works before using your own text.
- Check the Result box before you paste the text somewhere important.
- Press Clear before starting a new job so old text does not get mixed in.
Frequently asked questions
How do I remove spaces from the start and end of text online?
Paste your text in the Input text box and keep Side on its default, both. The trimmed text appears in the Result box, ready to copy or download.
What does the Side option do?
It controls which side of the text is trimmed. The default is both, meaning the start and the end.
What is the default side?
The default is both.
How do I copy the trimmed text?
Press Copy result. The button changes to Copied! when the text is on your clipboard.
Can I download the trimmed text?
Yes. Press Download .txt to save the result as a plain text file.
Is my text uploaded to a server?
The tool processes text on the page with JavaScript, and its code does not send your text to an API. Still, do not paste confidential text on a computer you do not trust.
How do I clear the text and start again?
Press Clear to reset the tool, then add your new text.