C#: Decode base64 String

Last time I had an example of Encoding of string into base64. This time Decoding.

Below is the c# code block that will convert the provided base64 string into readable one. This c# code will first decode the base64 string into byte array. After that it will convert that byte array into String data.


// "hello world"
String stringData = "aGVsbG8gd29ybGQ=";
Byte[] byteData = Convert.FromBase64String(stringData);
stringData = Encoding.ASCII.GetString(byteData);
Console.WriteLine(stringData);

Comments