0
var encodeString = GlideStringUtil.base64Encode('Workingcode.in');
gs.print(encodeString)
gs.print(GlideStringUtil.base64Decode(encodeString))

If you are in a scoped application, the GlideSystem object has methods:

gs.base64Decode()

gs.base64Encode()

How to use base64Encode and base64Decode in ServiceNow
Working Code Asked question July 20, 2023