Logo

Programming-Idioms

Assign to the string s the standard base64 encoding of the byte array data, as specified by RFC 4648.
New implementation

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
using System;
string s = Convert.ToBase64String(data);
import 'dart:convert';
var s = base64.encode(data);
import "encoding/base64"
s := base64.StdEncoding.EncodeToString(data)
final s = data.encodeBase64().toString()
let s = btoa(data);
import static java.util.Base64.getEncoder;
byte data[] = s.getBytes();
String s = getEncoder().encodeToString(data);
uses base64;
s := EncodeStringBase64(data);
use MIME::Base64;
$encoded = encode_base64('Aladdin:open sesame');
$decoded = decode_base64($encoded);
import base64
b = base64.b64encode(data)
s = b.decode()
require 'base64'
s = Base64.strict_encode64(data)
let s = base64::encode(data);
(require net/base64)
(base64-encode
 (list->bytes
  (map char->integer
       (string->list "hi there"))))
Imports System
Dim s As String = Convert.ToBase64String(data)