Skip to content
Advertisement

Tag: base64

Determine if string is in base64 using JavaScript

I’m using the window.atob(‘string’) function to decode a string from base64 to a string. Now I wonder, is there any way to check that ‘string’ is actually valid base64? I would like to be notified if the string is not base64 so I can perform a different action. Answer If “valid” means “only has base64 chars in it” then check

Advertisement