Text & String Utilities100% Client-Side

Remove Whitespace at Both Line Edges

Paste several lines to remove leading and trailing whitespace from each one. The tool retains spaces between words and keeps line positions, even when a whitespace-only line becomes empty. This is useful when a copied list arrives with unwanted padding but the separation between sections still matters. Check the output before using it with code or any format where indentation carries meaning.

Input
35 chars•2 lines
Output

How to Use the Trim Whitespace from Lines Online

  1. 1Paste the complete source block, including whitespace at the edges.
  2. 2Compare each cleaned line against the original to see what changed.
  3. 3Confirm that any blank lines you intended to keep still occupy their positions.
  4. 4Copy the cleaned text once its indentation fits the destination's requirements.

Input & Output Examples

The boundaries of both lines are trimmed, and the two spaces between left and right stay.

Input Sample
 	left  right 
  next	
Expected Output
left  right
next

The middle line becomes empty and keeps its position. The output uses LF separators.

Input Sample
one  
 	
  two
Expected Output
one

two

Practical Developer Workflows

  • Remove padding around each label in a list copied out of a report.
  • Normalize the edges of plain-text records while keeping intentional spaces inside their values.
  • Prepare a fixture that strips indentation but retains blank separators for comparison.

Zero Server Uploads & Complete Privacy

Runs 100% in your browser; no data is uploaded to any server.

Notice a bug, calculation error, or outdated info?

Let us know directly so our engineering team can fix it.

Frequently Asked Questions

Spaces and tabs inside a nonempty line remain. The tool trims only the two edges of each line. Use Remove All Whitespace if you want an uninterrupted string with the inner spaces removed as well.

Explore Other Tools

12 suggested tools

View all tools