← Back to Home

Encode Text

/encode
Encode text in various formats including Base64, URL encoding, and hexadecimal.
Try it now

Parameters

text body
Text to encode
format body
Format: base64, url, or hex (default: base64)

Examples

curl
# Base64 encode
curl -X POST https://tcpdata.com/encode \
  -H "Content-Type: application/json" \
  -d '{"text":"Hello World!","format":"base64"}'

# Returns: {"encoded":"SGVsbG8gV29ybGQh"}

# URL encode
curl -X POST https://tcpdata.com/encode \
  -H "Content-Type: application/json" \
  -d '{"text":"hello world!","format":"url"}'

# Hex encode
curl -X POST https://tcpdata.com/encode \
  -H "Content-Type: application/json" \
  -d '{"text":"ABC","format":"hex"}'
JavaScript (fetch)
const response = await fetch('https://tcpdata.com/encode', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    text: 'Hello World!',
    format: 'base64'
  })
});
const result = await response.json();
console.log(result.encoded);
Python (requests)
import requests

response = requests.post('https://tcpdata.com/encode', json={
    'text': 'Hello World!',
    'format': 'base64'
})
print(response.json()['encoded'])