Files and folders

Encode and decode base64

Turn text or a file into base64 and back, straight from the terminal.

Fill these in once
  1. Encode text
    Terminal
    echo -n 'hello world' | base64
  2. Decode text
    Terminal
    echo 'aGVsbG8gd29ybGQ=' | base64 --decode
  3. Encode a file
    Terminal
    base64 -i logo.png
  1. Encode text
    Terminal · Ubuntu / Debian
    echo -n 'hello world' | base64
  2. Decode text
    Terminal · Ubuntu / Debian
    echo 'aGVsbG8gd29ybGQ=' | base64 --decode
  3. Encode a file
    Terminal · Ubuntu / Debian
    base64 -w 0 logo.png
  1. Encode text
    PowerShell
    [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes('hello world'))
  2. Decode text
    PowerShell
    [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String('aGVsbG8gd29ybGQ='))
  3. Encode a file
    PowerShell
    [Convert]::ToBase64String([IO.File]::ReadAllBytes("$PWD\logo.png"))