Urgent.News

What's breaking now, across thousands of outlets.

Tech

What Is Base64? How to Encode and Decode It (and Why It Is Not Encryption)

Quick answer: Base64 writes any data using only letters, numbers, + and / . To encode or decode text, choose Encode or Decode, paste your text and copy the result. It is not encryption : anyone can decode it. Why does Base64 exist? Some systems (email, JSON, URLs) only handle plain text safely. Base64 turns bytes, such as an image, into plain text so they can travel through those systems. The…

Base64 is a method of encoding data using letters, numbers, plus (+), and slash (/) characters. To work with Base64, you can use the Encode or Decode functions, paste your input, and obtain the output. It is not a form of encryption, as anyone can decode the transformed data. The primary purpose of Base64 is to represent any data type, such as images or multimedia content, using plain text format.

This enables the data to be transmitted through systems that only accept text, like email, JSON, or URLs. However, this conversion comes at the expense of increased size, as Base64 is approximately one-third larger than the original data. For instance, the word "hello" becomes "aGVsbG8=" in Base64.

In JavaScript, you can encode and decode text using the built-in functions btoa() and atob(). These functions are limited to Latin-1 characters, so they may not work correctly with languages like Urdu, Hindi, Arabic, or emojis. To overcome this limitation, you can convert the text to UTF-8 bytes before encoding and then decode it using the corresponding functions.

URL-safe Base64 is a variation of the standard encoding method, which replaces the "+" and "/" characters with "-" and "_" respectively, and eliminates the trailing "=" padding. This modification allows the encoded data to be safely included in URLs, such as in JSON Web Tokens (JWTs). You can create a custom function to convert standard Base64 strings to URL-safe format.

It is essential to remember that Base64 is not a security measure. It merely alters the appearance of the data without providing any protection. If you need to safeguard sensitive information like passwords or encryption keys, you must employ proper encryption techniques rather than relying on Base64 encoding. For your convenience, I have included a free browser-based Base64 encoder and decoder, along with a JSON formatter and a URL encoder, which operate locally without uploading any data.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

The fix ships weeks before your scanner knows

In late September I published a release of compose-lint , a security linter for Docker Compose files that I maintain. It fixed two vulnerabilities , and I published the advisories about fifteen…

  • Compose-lint fixes two vulnerabilities in Docker Compose files.
  • GitHub takes 44 days to review advisories, exposing scanners.
  • Updating releases, not advisory reviews, reduces exposure time.

A practical checklist for links that land on the right page

I maintain the six small web projects used in the examples below. This note shares a repeatable way to check links to specific features and guides, with a small evidence log you can reuse in your own…

  • Clearly state promise of link content
  • Document expected content after clicking
  • Verify both intended and final URLs

How to Turn a Postman Collection into an MCP Server

Plenty of APIs are described by a Postman collection and nothing else. The team tests in Postman, shares the collection with partners and never got around to writing an OpenAPI spec.

  • Convert Postman collection to MCP server using DocStar
  • Export collection from Postman, import into DocStar
  • Publish server URL, sign in with OAuth or API keys

More from Thursday 12 November →