Python (Scripting) - Base64 encoding and decoding

by
Jeremy Canfield |
Updated: April 01 2024
| Python (Scripting) articles
The base64 module can be used for base64 encoding.
#!/usr/bin/python
import base64
print(base64.b64encode("Hello World"))
Which should return the following.
SGVsbG8gV29ybGQ=
Or for decoding.
#!/usr/bin/python
import base64
print(base64.b64decode("SGVsbG8gV29ybGQ="))
Which should return the following.
Hello World
Did you find this article helpful?
If so, consider buying me a coffee over at