Skip to main content

Encoding Converter

Encode and decode URL, HTML, Base64, and more

Text encoding and decoding tools are indispensable for web developers, security researchers, and anyone working with data across systems. URL encoding ensures special characters are safely transmitted in web addresses, preventing broken links and injection vulnerabilities. Base64 encoding converts binary data into a text-safe ASCII format used in email attachments, JWT tokens, and embedding images in HTML. HTML entity encoding prevents cross-site scripting (XSS) attacks by neutralizing characters that would otherwise be interpreted as markup. MegaCalc's encoding tool handles all common encoding schemes quickly and accurately.

Encoding Tool

Encoding Converter

URL Encoded

Hello%2C%20World!%20%3Cscript%3Ealert('xss')%3C%2Fscript%3E

HTML Entities

Hello, World! <script>alert('xss')</script>

Base64

SGVsbG8sIFdvcmxkISA8c2NyaXB0PmFsZXJ0KCd4c3MnKTwvc2NyaXB0Pg==

JWT Decoded

Hello, World! <script>alert('xss')</script>

Unicode Escape

Hello, World! <script>alert('xss')</script>

About Encoding Units

URL encoding (percent-encoding) replaces unsafe characters with a percent sign followed by the character's hexadecimal ASCII code — for example, a space becomes %20. Base64 encoding represents binary data using 64 printable characters (A–Z, a–z, 0–9, +, /), producing output about 33% larger than the input. HTML entity encoding replaces characters like < and > with &lt; and &gt; to prevent browser misinterpretation. JSON encoding handles special characters in JSON strings for safe data interchange.

History of Encoding Measurement

The development of encoding measurement reflects humanity's evolving needs for precision and international consistency. Early measurement systems were tied to physical artifacts, human body parts, or regional conventions, which led to a profusion of units across different cultures and industries. The metric system introduced in late 18th-century France laid the foundation for international standardization, and the formal adoption of the International System of Units (SI) in 1960 provided the modern framework for scientific and commercial measurement. Today's encoding units trace their definitions to fundamental physical constants, ensuring consistency across laboratories, industries, and international trade.

Practical Tips for Encoding Conversions

When working with encoding conversions, settle on a single unit system at the start of a project and convert all input data to that system before performing calculations. Mid-project unit changes are a common source of errors. For safety-critical work, verify conversions using two independent methods and cross-check against published references. Keep a record of unit choices and conversion factors in your working notes so others can reproduce your calculations.

Common Pitfalls to Avoid

The most common errors in encoding conversion involve mixing units from different systems without converting first, applying the wrong direction of a conversion factor, or using approximate values where precision is needed. Differences between US and UK customary units cause frequent confusion in international contexts. When converting between significantly different scales, double-check the decimal point placement and the power of ten — off-by-a-factor-of-ten errors are surprisingly common.

Professional Uses

Engineers, scientists, technicians, and tradespeople use encoding conversions daily to reconcile data from different sources, compare products and specifications across international markets, and verify that calculations are dimensionally consistent. Academic researchers rely on precise unit conversions when building on work from other institutions or countries. Regulatory compliance often requires reporting measurements in specific units, making conversion an essential routine step.

All Encoding Conversions

Frequently Asked Questions

What is URL encoding and when do I need it?

URL encoding (percent-encoding) converts characters that are not allowed or that have special meaning in URLs into a safe format. For example, spaces become %20, ampersands become %26, and equals signs become %3D. You need URL encoding when constructing query strings in web applications, passing parameters in API calls, or building links that contain special characters. Failure to URL-encode can result in broken links or security vulnerabilities.

What is Base64 and what is it used for?

Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). It is used to safely transmit binary data over text-based systems. Common uses include embedding images in HTML and CSS (data URIs), encoding email attachments (MIME), storing binary data in JSON, and encoding the payload in JWT (JSON Web Token) authentication tokens. Base64 encoded data is about 33% larger than the original.

What is the difference between encoding and encryption?

Encoding transforms data into a different format for compatibility or transmission purposes — it is not secure and can be reversed by anyone with the algorithm. Examples: Base64, URL encoding, HTML entities. Encryption transforms data to protect its confidentiality using a secret key — only someone with the correct key can reverse it. Examples: AES, RSA. Base64 encoding is often mistaken for encryption, but encoded data is fully readable by anyone who applies the decoding algorithm.