You can use built-in encodeBase64 method in Groovy:


assert "AQID" == ([1,2,3] as byte[]).encodeBase64() as String


And you saw, decodeBase64 is the opposite. Does that do what you want?




From: Nelson, Erick []
Sent: Friday, May 12, 2017 10:07 PM
Subject: Re: Binary to Base64 Conversion


Apache Commons codec


Erick Nelson

Senior Developer

HD Supply, FM

Cell 858-740-6523

Home 760-930-0461


CONFIDENTIALITY NOTICE: This message is for intended addressee(s) only and may contain information that is confidential, proprietary or exempt from disclosure, and subject to terms at:


From: RJ <>
Reply-To: "" <>
Date: Friday, May 12, 2017 at 7:05 PM
To: "" <>
Subject: Binary to Base64 Conversion


I have to deal with a binary value of base64 ID in a groovy script. So, first I need to covert binary data to base64 format and then decodeBase64().

Any clues/thoughts ? Thanks!!

This email message and any attachments are for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message and any attachments.