← 返回
未分类

Base64 Encode

Encode or decode text using Base64, URL percent-encoding, or HTML entities. Use when the user asks to encode, decode, base64 encode, base64 decode, URL encod...
使用 Base64、URL 百分号编码或 HTML 实体对文本进行编码或解码。当用户请求编码、解码、Base64 编码/解码、URL 编码等操作时使用。
ohernandez-dev-blossom
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 404
下载
💾 2
安装
1
版本
#latest

概述

Base64 / URL / HTML Encoder & Decoder

Encode or decode text using Base64, URL percent-encoding, or HTML entities. Processes text client-side with no external calls.

Input

  • The text string to encode or decode
  • Encoding type: base64 (default), url, or html
  • Direction: encode (default) or decode

Output

  • The transformed string
  • A brief note on the encoding type and direction applied

Instructions

Base64 (type: base64)

Encode:

  1. Take the input string.
  2. Convert each character to its UTF-8 byte sequence (handle non-ASCII/Unicode correctly).
  3. Apply Base64 encoding using the standard alphabet (A–Z, a–z, 0–9, +, /).
  4. Pad with = characters to make the length a multiple of 4.
  5. The algorithm equivalent is: btoa(unescape(encodeURIComponent(input))).

Decode:

  1. Take the Base64-encoded input.
  2. Validate it contains only valid Base64 characters (A–Z, a–z, 0–9, +, /, =).
  3. Decode using: decodeURIComponent(escape(atob(input))).
  4. Return the original UTF-8 string.

URL Percent-Encoding (type: url)

Encode:

  1. Apply encodeURIComponent semantics: encode every character except A–Z a–z 0–9 - _ . ! ~ * ' ( ).
  2. Spaces become %20 (not +).
  3. Non-ASCII characters are UTF-8 encoded then percent-escaped.

Decode:

  1. Replace each %XX sequence with the corresponding byte.
  2. Interpret the resulting bytes as UTF-8.
  3. Equivalent to decodeURIComponent(input).

HTML Entities (type: html)

Encode: Replace these characters with their named HTML entities:

  • <<
  • >>
  • &&
  • ""
  • ''

Decode: Reverse the mapping — replace each HTML entity with its literal character.

Options

  • type: base64 | url | html — default: base64
  • direction: encode | decode — default: encode

Examples

Base64 encode:

Input: Hello, World!

Output: SGVsbG8sIFdvcmxkIQ==

Base64 encode (Unicode):

Input: Héllo

Output: SMOpbGxv

Base64 decode:

Input: SGVsbG8sIFdvcmxkIQ==

Output: Hello, World!

URL encode:

Input: name=John Doe&city=New York

Output: name%3DJohn%20Doe%26city%3DNew%20York

URL decode:

Input: hello%20world%21

Output: hello world!

HTML encode:

Input:

Output: <script>alert("XSS")</script>

HTML decode:

Input: <h1>Hello & welcome</h1>

Output:

Hello & welcome

Error Handling

  • Invalid Base64 input for decode: If the string contains characters outside the Base64 alphabet or has incorrect padding, report: Error: Invalid Base64 string. Ask the user to verify the input.
  • Invalid URL encoding for decode: If a %XX sequence uses non-hex digits or the sequence is incomplete, report: Error: Invalid URL encoded string.
  • Empty input: Return an empty string with a note that no input was provided.
  • Binary/non-text data: Warn the user that Base64 encoding of binary data requires the raw bytes, which cannot be provided as plain text — suggest they use a tool that accepts file uploads.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-31 06:42 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

Shared Brain

ohernandez-dev-blossom
跨多个AI代理的共享持久记忆层。适用于首次设置多代理工作空间,或代理发现永久...
★ 0 📥 437

Json Format

ohernandez-dev-blossom
格式化、美化、压缩或验证 JSON。当用户需要格式化、美化、压缩、验证 JSON 数据时使用。
★ 0 📥 537

Case Convert

ohernandez-dev-blossom
将文本在不同命名格式之间转换,如驼峰式、下划线式、连字符式、帕斯卡式、全大写、全小写、标题式等。
★ 0 📥 486