Skip to main content

/encode - Encode/Decode Data

Encode and decode data in various formats including Base64, URL encoding, and hex.

System Prompt

EXECUTION DIRECTIVE: When /encode is invoked, IMMEDIATELY process the encoding/decoding.

Usage

# Base64
/encode base64 "Hello World" # Encode to Base64
/encode base64 -d "SGVsbG8gV29ybGQ=" # Decode from Base64

# URL encoding
/encode url "hello world & more" # URL encode
/encode url -d "hello%20world" # URL decode

# Hex
/encode hex "Hello" # To hex
/encode hex -d "48656c6c6f" # From hex

# JSON escape
/encode json '{"key": "value"}' # Escape for JSON string

# File encoding
/encode base64 -f image.png # Encode file to Base64

Execution

~/.coditect/scripts/encode.sh base64 "text"
~/.coditect/scripts/encode.sh base64 -d "encoded"
~/.coditect/scripts/encode.sh url "text"
~/.coditect/scripts/encode.sh hex "text"

Encoding Types

TypeEncodeDecode
base64Text to Base64Base64 to text
urlURL encode spaces/specialURL decode
hexText to hexadecimalHex to text
jsonEscape for JSON stringUnescape JSON
htmlHTML entitiesDecode entities

Output Format

======================================================================
Encode/Decode Result
======================================================================

Input: Hello World
Type: base64 (encode)
Output: SGVsbG8gV29ybGQ=

[Copied to clipboard]

======================================================================

Examples

Base64 Encoding

$ /encode base64 "Hello World"
SGVsbG8gV29ybGQ=

$ /encode base64 -d "SGVsbG8gV29ybGQ="
Hello World

URL Encoding

$ /encode url "name=John Doe&city=New York"
name%3DJohn%20Doe%26city%3DNew%20York

$ /encode url -d "name%3DJohn%20Doe"
name=John Doe

Hex Encoding

$ /encode hex "ABC"
414243

$ /encode hex -d "414243"
ABC

Implementation

#!/bin/bash
case "$1" in
base64)
if [ "$2" = "-d" ]; then
echo "$3" | base64 -d
else
echo -n "$2" | base64
fi
;;
url)
if [ "$2" = "-d" ]; then
python3 -c "import urllib.parse; print(urllib.parse.unquote('$3'))"
else
python3 -c "import urllib.parse; print(urllib.parse.quote('$2'))"
fi
;;
esac
CommandPurpose
/uuidGenerate UUIDs
/json-formatFormat JSON

Version: 1.0.0 Created: 2026-01-15 Author: CODITECT Team