[null] Removing "NUL" characters

I have got characters like that in my notepad++

npp screenshot of NULs

When i am trying to copy whole line, i am actually copying everything until "NUL":

File:1

What i want to do, is replace those null, to be nothing, so i can copy my whole line. Maybe there is any keyword that will tell notepad++(or any other program that might help) to replace those characters? When i am selecting it, use Right Click and then "clear", its gone - but i dont want to do it one by one.

I don't care about removing the cause of this problem, just the effect(NULs)

This question is related to null char notepad++

The answer is


Try Find and Replace. type \x00 in Find text box, check the Regular expression option. Leave Replace textbox blank and click on replace all. short cut key for find and replace is ctrl+H.


Highlight a single null character, goto find replace - it usually automatically inserts the highlighted text into the find box. Enter a space into or leave blank the replace box.


Click Search --> Replace --> Find What: \0 Replace with: "empty" Search mode: Extended --> Replace all


I was having same problem. The above put me on the right track but was not quite correct in my case. What did work was closely related:

  • Open your file in Notepad++
  • Type Control-A (select all)
  • Type Control-H (replace)
  • In 'Find What' type \x00
  • In 'Replace With' leave BLANK
  • In 'Search Mode' Selected 'Extended'
  • Then Click on 'Replace All'

Open Notepad++
Select Replace (Ctrl/H)
Find what: \x00
Replace with:
Click on radio button Regular expression
Click on Replace All


I tried to use the \x00 and it didn't work for me when using C# and Regex. I had success with the following:

//The hexidecimal 0x0 is the null character  
mystring.Contains(Convert.ToChar(0x0).ToString() );  

// This will replace the character
mystring = mystring.Replace(Convert.ToChar(0x0).ToString(), "");  

Examples related to null

getElementById in React Filter values only if not null using lambda in Java8 Why use Optional.of over Optional.ofNullable? How to resolve TypeError: Cannot convert undefined or null to object Check if returned value is not null and if so assign it, in one line, with one method call How do I assign a null value to a variable in PowerShell? Using COALESCE to handle NULL values in PostgreSQL How to check a Long for null in java Check if AJAX response data is empty/blank/null/undefined/0 Best way to check for "empty or null value"

Examples related to char

How can I convert a char to int in Java? C# - How to convert string to char? How to take character input in java Char Comparison in C Convert Char to String in C cannot convert 'std::basic_string<char>' to 'const char*' for argument '1' to 'int system(const char*)' How to get the real and total length of char * (char array)? Why is conversion from string constant to 'char*' valid in C but invalid in C++ char *array and char array[] C++ - How to append a char to char*?

Examples related to notepad++

How to view Plugin Manager in Notepad++ How to format JSON in notepad++ CR LF notepad++ removal How to install a Notepad++ plugin offline? Find duplicates and delete all in notepad++ How to compare two files in Notepad++ v6.6.8 Notepad++ cached files location How to indent HTML tags in Notepad++ How to change background color in the Notepad++ text editor? How do I stop Notepad++ from showing autocomplete for all words in the file