Conversion Utilities

Bytes To Human

Converts raw byte counts into readable storage formats like "1.2 GB" or "512 MB". Access via MCP in Cursor or Windsurf, or REST at /v1/convert/data/bytes-to-human. Perfect for file size displays, memory usage reports, or bandwidth calculations. Handles up to exabytes with configurable decimal precision.

API Endpoint

GET /v1/convert/data/bytes-to-human

Code Examples

curl "https://tinyfn.io/v1/convert/data/bytes-to-human" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/convert/data/bytes-to-human', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/convert/data/bytes-to-human',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's conversion tools:

{
  "mcpServers": {
    "tinyfn-conversion": {
      "url": "https://tinyfn.io/mcp/conversion",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How do I convert bytes to human-readable format in my AI agent?

Use the MCP tool in Claude or Cursor, or call GET /v1/convert/data/bytes-to-human?bytes=1073741824. Returns formatted strings like '1.0 GB' with appropriate units.

What's the difference between binary and decimal byte conversion?

Binary uses 1024-based units (1 KB = 1024 bytes), decimal uses 1000-based (1 kB = 1000 bytes). Most file systems use binary, web contexts often use decimal.

Can I control decimal places in the output format?

Yes, specify precision parameter to control decimal places. Default is 1 decimal place, but you can set 0 for whole numbers or 2+ for more precision.

What's the largest byte value this tool can handle?

Supports up to exabyte range (10^18 bytes). Automatically selects appropriate unit from bytes, KB, MB, GB, TB, PB, EB based on input size.

How does this help with file upload progress indicators?

Convert raw byte counts from upload APIs into user-friendly displays. Instead of showing '2847392 bytes uploaded', display '2.7 MB uploaded' for better UX.

Try Bytes To Human Now

Get your free API key and start using Bytes To Human in seconds.

Get Free API Key