Decodes a Base64 String into octets. Note that this method handles both URL-safe and
non-URL-safe base 64 encoded strings.
For the compatibility with the old version that used Apache Commons Coded's decodeBase64,
this method discards new line characters and trailing whitespaces.
Encodes binary data using a URL-safe variation of the base64 algorithm but does not chunk the
output. The url-safe variation emits - and _ instead of + and / characters.
Encodes binary data using a URL-safe variation of the base64 algorithm but does not chunk the
output. The url-safe variation emits - and _ instead of + and / characters.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Class Base64 (2.0.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.0.0 (latest)](/java/docs/reference/google-http-client/latest/com.google.api.client.util.Base64)\n- [1.47.1](/java/docs/reference/google-http-client/1.47.1/com.google.api.client.util.Base64)\n- [1.46.3](/java/docs/reference/google-http-client/1.46.3/com.google.api.client.util.Base64)\n- [1.45.3](/java/docs/reference/google-http-client/1.45.3/com.google.api.client.util.Base64)\n- [1.44.2](/java/docs/reference/google-http-client/1.44.2/com.google.api.client.util.Base64)\n- [1.43.2](/java/docs/reference/google-http-client/1.43.2/com.google.api.client.util.Base64)\n- [1.42.3](/java/docs/reference/google-http-client/1.42.3/com.google.api.client.util.Base64)\n- [1.41.8](/java/docs/reference/google-http-client/1.41.8/com.google.api.client.util.Base64) \n\n public class Base64\n\n**Deprecated.** *use com.google.common.io.BaseEncoding#base64*\n\nProxy for handling Base64 encoding/decoding. \n\nInheritance\n-----------\n\n[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e Base64 \n\nInherited Members\n-----------------\n\n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)\n\nStatic Methods\n--------------\n\n### decodeBase64(byte\\[\\] base64Data) (deprecated)\n\n public static byte[] decodeBase64(byte[] base64Data)\n\nDecodes Base64 data into octets. Note that this method handles both URL-safe and non-URL-safe\nbase 64 encoded inputs.\n\n### decodeBase64(String base64String) (deprecated)\n\n public static byte[] decodeBase64(String base64String)\n\nDecodes a Base64 String into octets. Note that this method handles both URL-safe and\nnon-URL-safe base 64 encoded strings.\n\nFor the compatibility with the old version that used Apache Commons Coded's decodeBase64,\nthis method discards new line characters and trailing whitespaces.\n\n### encodeBase64(byte\\[\\] binaryData) (deprecated)\n\n public static byte[] encodeBase64(byte[] binaryData)\n\nEncodes binary data using the base64 algorithm but does not chunk the output.\n\n### encodeBase64String(byte\\[\\] binaryData) (deprecated)\n\n public static String encodeBase64String(byte[] binaryData)\n\nEncodes binary data using the base64 algorithm but does not chunk the output.\n\n### encodeBase64URLSafe(byte\\[\\] binaryData) (deprecated)\n\n public static byte[] encodeBase64URLSafe(byte[] binaryData)\n\nEncodes binary data using a URL-safe variation of the base64 algorithm but does not chunk the\noutput. The url-safe variation emits - and _ instead of + and / characters.\n\n### encodeBase64URLSafeString(byte\\[\\] binaryData) (deprecated)\n\n public static String encodeBase64URLSafeString(byte[] binaryData)\n\nEncodes binary data using a URL-safe variation of the base64 algorithm but does not chunk the\noutput. The url-safe variation emits - and _ instead of + and / characters."]]