Notepad++: How to remove extra spaces at the start and end of each line


If you want to remove the spaces or tabs at the start and end of lines on Notepad++ you can either write your own regular expression with Replace option.

File in Notepad++ with leading and trailing spaces

But the best way to achieve this is by making use of the build option that you can find under Edit > Black Operation > Trim Leading and Trailing Space

Notepad++ Trim Leading and Trailing space
Result of Removing Spaces Notepad++

Tip: If you only want to trim certain line(s) then you can select it first and then use the trim option.

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap