A virtual teacher who reveals to you the great secrets of Base64

Validate Base64 using Notepad++

Validate Base64 using Notepad++

I love fast and flexible software. My love for it will increase exponentially if it is portable or supports such mode, so I can take the application everywhere and run it from anywhere. One of these applications is Notepad++, which I have been using for many years, and for the time being I am not going to switch to something else, even if it also has some disadvantages. The main drawback is that it supports only Windows, but it doesn’t affect me much, since I use Windows as the main OS.

Notepad++ is a free text editor that supports syntax highlighting for many programming languages and files types. It has many features and plugins that allow you to customize the application and automate various tasks. I am not going to describe all the functions of this editor, so I invite you to visit the official website, where you can learn everything about it.

Here I want to talk only about the search function, which is also a powerful feature of the Notepad++. Among other things it supports regular expressions, so you can do a lot of interesting things. For example, it was my faithful assistant while I was developing some tools, when I had to validate many Base64 values and find out why some values cannot be decoded. It turned out that in most cases the values contained invalid characters, so I used Notepad++ to find them. Of course, in this way I just checked for invalid characters, not so that it is a real Base64, but that was what I needed. Now you can use the Repair Tool or Base64 Validator, but I decided to share this method, perhaps it might be useful to you.

To validate Base64 using Notepad++ and find invalid characters:

  1. Start Notepad++
  2. Press Ctrl+N to open new tab
  3. Paste your Base64 value via Ctrl+V
  4. Open the Find&Replace dialog by pressing Ctrl+F
  5. Use [^A-Za-z0-9/+\s]+ as search pattern
  6. Switch “Replace Mode” to “Regular Expression”
  7. Click the “Find Next” button and analyze your results

The regular expression will find any characters that are not part of the Base64 Alphabet. I did not specify the padding character (equal sign), since it is important to know where the Base64 value ends and it would be useful to find concatenated strings, similar to this one: YWI=YWI=

Of course, you can change the regular expression to suit your needs or tune Notepad++ to make your job easier (for example, you can change highlight color to more easily notice the characters found).

Add new comment

If you have any questions, remarks, need help, or just like this page, please feel free to let me know by leaving a comment using the form bellow.
I will be happy to read every comment and, if necessary, I will do my best to respond as quickly as possible. Of course, spammers are welcome only as readers.

Loading...