Skip to content

Other

Base64 Encode/Decode

Enter your values and the result updates as you type. The formula and a worked example are below the calculator.

Text

Convert
Text size (UTF-8)
31 bytes
Base64 size
44 characters

File or image

I want to

The file is read on your device and never uploaded. Up to 25 MB.

Choose a file to see the result.

The Base64 alphabet

Each Base64 character stands for 6 bits (RFC 4648). Padding uses =.

0: A16: Q32: g48: w
1: B17: R33: h49: x
2: C18: S34: i50: y
3: D19: T35: j51: z
4: E20: U36: k52: 0
5: F21: V37: l53: 1
6: G22: W38: m54: 2
7: H23: X39: n55: 3
8: I24: Y40: o56: 4
9: J25: Z41: p57: 5
10: K26: a42: q58: 6
11: L27: b43: r59: 7
12: M28: c44: s60: 8
13: N29: d45: t61: 9
14: O30: e46: u62: +
15: P31: f47: v63: /

How to use

  1. Choose Encode or Decode, then type or paste your text. The result updates as you type.
  2. To encode, the text is converted to UTF-8 bytes first, so any language works. Open the output options for the URL-safe alphabet, no padding or line breaks.
  3. To decode, paste Base64 text. Spaces and line breaks are ignored and missing = padding is accepted. Pick the character set if the original text was not UTF-8.
  4. For a file or an image, use the file tool: choose the file, then copy or download the Base64 text. To decode, choose a file that holds Base64 and save the result as text or as a binary file.

Formula

Base64 splits the bytes into groups of 3 (24 bits) and writes each group as four 6-bit values, using A to Z, a to z, 0 to 9, + and / (RFC 4648). The output is about 4/3 the size of the input. If the last group is short, = padding fills it up.

Example

The text Dog is the bytes 68, 111, 103. That is 010001 000110 111101 100111, the values 17, 6, 61 and 39, which are the letters R, G, 9 and n: RG9n. Do (two bytes) gives RG8= and D gives RA==.

Base64 is an encoding, not encryption: anyone can decode it. Everything here runs in your browser and nothing is uploaded, but do not treat Base64 as a way to hide secrets.