I think you mean encoded, right?
Use
Convert.FromBase64String
method. If it throws FormatException, then the original string was not base64. Something like this:
public static bool IsBase64(string base64String){
if(base64String.Replace(" ","").Length % 4 != 0){
return false;
}
try{
Convert.FromBase64String(base64String);
return true;
}
catch(FormatException exception){
}
return false;
}
You can add null check etc to this method to make it less exception prone.