An easy way to convert data to/from base64 (or uuencode/uudecode, quoted-printable, url encode/url decode, JIS, Yenc, hex, or even creating md5 or sha1 hashes) is to use the NetCmdlets convert-data cmdlet. To encode:
PS C:\> convert-data -data "Hello, World!" -to base64
Data Size Format
---- ---- ------
SGVsbG8sIFdvcmxkIQ== 20 base64
To decode:
PS C:\> convert-data -data $encoded.Data data -from base64
Data Size Format
---- ---- ------
Hello, World! 13 Plain