Encoding and Decoding Base64 Strings in Python

0
13K

The Base64 encoding is used to convert bytes that have binary or text data into ASCII characters. Encoding prevents the data from getting corrupted when it is transferred or processed through a text-only system. In this article, we will discuss about Base64 encoding and decoding and its uses to encode and decode binary and text data. Each Base64 character represents 6 bits of data. it is also important to note that it is not meant for encryption for obvious reasons.

 

import base64
  
sample_string = "Hello world!"
sample_string_bytes = sample_string.encode("ascii")
  
base64_bytes = base64.b64encode(sample_string_bytes)
base64_string = base64_bytes.decode("ascii")
  
print(base64_string)
Search
Categories
Read More
Finance
How Can I Make Money Online?
How Can I Make Money Online? In today’s digital age, making money online has become easier...
By Leonard Pokrovski 2025-10-07 21:56:07 0 2K
Horror
The Exorcist. (1973)
When a teenage girl is possessed by a mysterious entity, her mother seeks the help of two priests...
By Leonard Pokrovski 2023-06-21 18:22:56 0 38K
Социальные проблемы
На игле. Trainspotting. (1996)
История четырёх друзей-наркоманов в Эдинбурге 1990-х годов. Кто-то из них пытается завязать, а...
By Nikolai Pokryshkin 2023-03-09 13:08:57 0 27K
Music
11 Chill Punk Vibes for Alternative Relaxation: A Unique Soundtrack to Unwind, Focus, and Let Go
When you think of punk, your mind might go straight to high-energy chaos, sweat-drenched shows,...
By Gpykin 2025-08-16 21:32:21 0 6K
Central America
Interesting Central American Countries / Cities
Ranking of Central American countries by interestingness Due to the fact that I spent as...
By FWhoop Xelqua 2023-01-08 16:38:34 0 22K

BigMoney.VIP Powered by Hosting Pokrov