> For the complete documentation index, see [llms.txt](https://docs.iwolfsec.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.iwolfsec.com/cheat-sheet/powershell/encode-and-decode-base64.md).

# Encode & decode Base64

## De binario a base64 con PowerShell

```powershell
$EXE_Path = "C:\Users\user\Desktop\mimikatz.exe"
$Base64_Code = [System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes("$EXE_Path"))

$Base64_Code | Set-content ($EXE_Path + ".b64")
Write-Host $EXE_Path + ".b64"
```

## De base64 a binario con PowerShell

```powershell

$b64 = Get-Content "C:\Users\user\Desktop\mimikatz.exe.b64"

$filename = 'C:\Users\user\Desktop\mimikatz.exe'

[IO.File]::WriteAllBytes($filename, [Convert]::FromBase64String($b64))
```
