Sunday, September 25, 2011

C#: Decode base64 String

Share at Facebook

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

1 comment:

buyi wen said...

you can try this free online service to convert base64 to string online.