Base32 Decode API: The Complete Guide

Need to decode Base32 data in your application? This guide covers everything you need to know about Base32 decoding via API, including how it works, common use cases, and implementation examples in multiple languages.

What is Base32 Decoding?

Base32 decoding converts Base32-encoded strings back to their original binary data or text. It reverses the encoding process by mapping each character back to its 5-bit value and reconstructing the original bytes.

Example: JBSWY3DP becomes Hello

How Base32 Decoding Works

The decoding process reverses the encoding:

Map Characters to Values

Each Base32 character is converted to its 5-bit value (A=0, B=1, ..., 7=31).

Combine into Bytes

The 5-bit values are combined and regrouped into 8-bit bytes.

Handle Padding

Padding characters (=) are removed and the final bytes are extracted.

Note: Base32 decoding is case-insensitive. Both uppercase and lowercase input will decode correctly.

Using the Base32 Decode API

TinyFn provides a simple endpoint to decode Base32 data:

API Request
POST https://api.tinyfn.io/v1/decode/base32
Headers: X-API-Key: your-api-key
Content-Type: application/json

{
  "data": "JBSWY3DPFQQFO33SNRSCC==="
}
Response
{
  "decoded": "Hello, World!",
  "original_length": 24,
  "decoded_length": 13
}

Parameters

Parameter Type Description
data string Base32 string to decode (required)

Code Examples

JavaScript / Node.js

const response = await fetch('https://api.tinyfn.io/v1/decode/base32', {
  method: 'POST',
  headers: {
    'X-API-Key': 'your-api-key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ data: 'JBSWY3DPFQQFO33SNRSCC===' })
});
const result = await response.json();
console.log(result.decoded); // "Hello, World!"

Python

import requests

response = requests.post(
    'https://api.tinyfn.io/v1/decode/base32',
    json={'data': 'JBSWY3DPFQQFO33SNRSCC==='},
    headers={'X-API-Key': 'your-api-key'}
)
result = response.json()
print(result['decoded'])  # "Hello, World!"

cURL

curl -X POST "https://api.tinyfn.io/v1/decode/base32" \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"data": "JBSWY3DPFQQFO33SNRSCC==="}'

Common Use Cases

  • TOTP Verification: Decode authenticator app secrets
  • Data Recovery: Decode Base32-encoded configuration data
  • URL Processing: Decode Base32 data from URLs
  • Protocol Implementation: Decode data in various protocols
  • Legacy Systems: Interact with systems using Base32 encoding

Best Practices

  1. Validate input: Check for valid Base32 characters before decoding
  2. Handle padding: Support both padded and unpadded input
  3. Case handling: Normalize to uppercase before decoding if needed
  4. Error handling: Gracefully handle invalid Base32 strings

Try the Base32 Decode API

Get your free API key and start decoding Base32 data in seconds.

Get Free API Key

Ready to try TinyFn?

Get your free API key and start building in minutes.

Get Free API Key