Base64.getEncoder().encodeToString()

Encodes the given array of bytes into a Base64-encoded string.


Function

public static java.lang.String encode(byte[] data)

Parameters

data - The bytes to be encoded.

Return value

A valid Base64-encoded string representing the input data.

Example

import java.util.Base64;
import java.nio.charset.StandardCharsets;

public class Base64Encode {
  public static void main(String[] args) {
    String original = "I will comeback soon";
    byte[] bytes = original.getBytes(StandardCharsets.UTF_8);
    String encoded = Base64.getEncoder().encodeToString(bytes);

    System.out.println(encoded);
  }
}

Home Page Base64encode List Privacy Policy About Us Contact

This website uses cookies to enhance your experience, personalize content and ads, and analyze our traffic.

©2025 Design by base64encodeonl.com