Remove All Unwanted Characters Using Notepad And Notepad++: Whitespace, Tabulation, And More

Remove All Unwanted Characters Using Notepad And Notepad++: Whitespace, Tabulation, And More

Having a text file with data, usually coming from a CSV export, might contain unwanted elements such as whitespace or tabs, that have to be removed from the file in order to be able to process it.

This operation can be done either with Windows built-in Notepad app, or with the excellent Notepad++ that is my favorite solution to edit many files, as it allows to manage text files by tabs and provides great text coloring features.

In general, in most applications, you can remove whitespace using the search and replace function, usually available with the CTRL+H keyboard shortcut.

But let's see in detail how to perform this operation in different cases: in Notepad remove whitespace in one text, remove space in Excel sheet or full workbook, in  Microsoft Word ‌  replace double whitepace with single whitespace, in Notepad++ remove whitespace in a text selection or a group of documents, and more, all using an example CSV export of similar questions asked from!

Remove whitespaces in document

The easiest solution to perform this operation on any text being to perform a Notepad++ remove whitespace operation in that text editing software, as it is very fast and well optimized. However, it is possible to remove whitespaces in nearly any program that manages text.

Also Asked: Notepad remove whitespace questions

Remove WhiteSpace in Notepad

Using the Windows10 Notepad application, removing all whitepaces from a data file can be pretty simple, using the CTRL+H replace function.

How to remove whitespace in Notepad? Use the CTRL+H replace option

All you have to do is to open a new Notepad window, paste your text, or open an existing file containing the text.

Use the key combination CTRL+H to open the replace form, and there, enter a whitespace in the Find What field, and make sure that that Replace With field remains empty.

Click the Replace All button to start replace all whitespaces in the file with nothing, which practically means that you'll be removing any whitespace left in the text.

Excel: Remove Whitespace

The operation to remove space in Excel also is as simple as using the search and replace function, that is accessible with the CTRL+H keyboard shortcut.

How to remove space in Excel? Use the CTRL+H find and replace option

The  Microsoft Excel ‌  Find and replace box will show up, in which you can fill in the Find What field with a whitespace to replace, and the Replace with field with nothing, an empty string, in order to remove extra spaces in Excel using the Replace all function.

After having clicked on the Replace all button, the program will remove blank spaces in Excel sheet that is currently opened, and a confirmation message will let you know how many replacements have been done overall.

By default, the search and replace operation will be applied on the currently active sheet only. By displaying the extra options, you can change the scope of the whitespace search and replace to the whole workbook by changing the Within value from sheet to workbook.

The Wrap around checkbox means that the search and replace operation will start again at the beggining of the file and perform the operation up to your current cursor position, in case your cursor is not at the beggining of the file.

Otherwise, the search and replace operation will be performed from the current cursor position up to the end of the file only, thus not removing whitepaces in whole Notepad file, but only from current position to the end of the file.

Notepad++: Remove Whitespace in text document

Using any  version of Notepad++ ‌  software you will be able to easily perform an advanced notepad remove whitespace operation that can apply to any text, file, text selection, or group of files, with only a few clicks.

How to remove whitespace in Notepad++? Open the replace box with CTRL+H keyboard shortcut

If you haven't done so, start by download and installing the latest version of the amazing  Notepad++ application ‌  for free from their website:

Then, either open a file as text in which you want to remove whitespace or other unwanted characters, and get to the Replace box by using the CTRL+H keyboard shortcut.

In the Replace window, enter a whitespace in the Find what field, and make sure that the Replace with field remains empty.

Then, the choice is yours to perform an advanced Notepad++ remove whitepace or other characted operation:

  • Replace the next occurrence of a whitespace in target displayed text by clicking the Replace button,
  • Replace all whitespace occurrences in target currently visible text file by clicking the Replace All button,
  • Replace only the next or all occurrences in selected text by validating the In Selection checkbox and selecting either the Replace or the Replace All function,
  • Remove whitepaces in all Notepad++ files currently opened by clicking the Replace all in all opened documents button - beware, this powerful operation can be done by mistake if you click on that button instead of another one!
  • Replace whitepaces only from current cursor position up to the end of the text by unchecking the Wrap around option, that allows otherwise the operation to be applied in the whole file.

After having selected the operation that works best in your situation, the number of successful whitepace removing operations will be displayed in the search and replace window's status box.

Going further: use NotePad++ to replace tabs with spaces

It is possible to do a Notepad++ replace tabs with spaces operation that way: select a tab with your mouse in the text, and copy it.

Then, open the search and replace window with CTRL-H key combination, and paste the tab to replace with spaces in the search field, and type a space in the replace field.

The copy and paste operation is necessary to copy one of the tabs to replace with spaces in Notepad++ because if you try typing a tabulation, the program will interpret it as a key shortcut to highlight the next available field in the search form. Therefore, to use Notepad++ to replace tabs with spaces, simply copy a tabulation from the text and paste it in the search field!

Remove whitespace in Word document

Removing whitespaces in a Word document, or more practically replacing double whitespace with a single whitespace, can also be done in  Microsoft Word ‌  with a single click.

How to remove whitespaces in Word? Use the find and replace box with CTRL+H keyboard shortcut

Start by opening the find and replace form with the keyboard shortcut CTRL+H.

Then, enter in find what the text that you want to search for, such as double whitespace, and enter in Replace with field the text by which you want to replace the search, such as a single whitespace.

Then, simply click on the Replace All button to perform the search and replace operation on the whole text in currently opened document.

After the substitution operation, a confirmation box with the number of occurences replaced will be displayed.

The takeaway: remove string from any text

You can even go further by replacing any character or text in a document by an empty character string - thus removing characters from the Notepad++ documents, opened files, pasted text, or text selection!

The most powerful tool for this operation being the amazing Notepad++ program, as you will be able to perform the operation on a selection or a group of files in a single click.

However, you can replace any text in any documents that way, and use the CTRL+H search and replace box to remove whitespaces, get rid of tabulations, or substitute double spaces with single whitespace for example, thus correcting errors in your text within a single clic!

Frequently asked questions and answers about removing whitespace in Notepad

How do I remove notepad as my default?
Change the Windows10 file association for Notepad app to switch it to the excellent Notepad++ for example.
How do I change the default zoom in notepad?
Use the menu function view and zoom to zoom in or out.
What is the font used in notepad?
The font used in Notepad is Lucida Console.
What do the colors mean in Notepad ++ compare?
The red color in Notepad++ compare means that line is missing in the other file, and green color means that line has been added in the file.
How do I replace in notepad?
Replace in Notepad using the CTRL+H keyboard shortcut.
What is LF character in notepad?
LF character in Notepad is a line break.
What is the new line character in notepad?
The new line character in Notepad is \n.
How do I uninstall Notepad ++?
You can uninstall Notepad++ using the Windows10 Add or remove programs app.
How do I sort in notepad?
You have to copy and paste text out of Notepad to sort it. You can sort in Notepad++ using the  order a list ‌  functions of the TextFX Tools plugin.
How do I align text in Notepad ++?
You can align text in Notepad++ by selecting the text to align, and use the Tab keyboard key to align to the right, and Shift+Tab keyboard shortcut to align selected text to the left.
How do you remove unmarked lines in Notepad ++?
Use the function in menu search, bookmark, remove bookmarked lines.
How do I replace text in Notepad?
Replace text in Notepad using the search and replace function available with CTRL+H keyboard shortcut.
How do I find Notepad?
Notepad can be found using the Windows search function, in the bottom left of the screen, right next to the Windows logo.
How do I delete text after Notepad ++?
Delete specific text after a given character position in Notepad++ by performing a search and replace with CTRL+H in selection, selecting text after given character, and entering the text to delete in the search field.
How do I change from Wordpad to Notepad?
To change from WordPad to Notepad, save your file in Wordpad, close the program, and open the file in Notepad. Consider to change the file association if you want the files to open in Notepad by default.
10 of the Best Programming Fonts
Introducing extended line endings support in Notepad
How can I remove a trailing newline?

Comments (0)

Leave a comment