Formatting Utilities

Format Bytes

Converts raw byte counts into human-readable formats like "2.5 GB" or "847 KB". Use via MCP in Cursor or Windsurf, or call GET /v1/format/bytes with your byte value. Perfect for file size displays, storage calculations, or bandwidth reporting. Returns standardized units following binary (1024) or decimal (1000) conventions.

API Endpoint

GET /v1/format/bytes

Code Examples

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

response = requests.get('https://tinyfn.io/v1/format/bytes',
    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 formatting tools:

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

Learn more about MCP setup →

FAQ

How do I format bytes to human readable size with MCP?

Call the format_bytes tool with your byte count. It returns formatted strings like '1.5 GB' or '512 MB' with appropriate unit scaling.

Does format bytes use binary (1024) or decimal (1000) units?

Most implementations use binary units (1024 bytes = 1 KB) by default, matching how operating systems typically display file sizes.

What's the maximum byte value I can format?

Supports values up to petabytes and beyond, handling both integer and floating-point inputs for precise storage calculations.

Can I customize the decimal precision in formatted output?

Yes, most formatters allow precision control. Small files show exact bytes, larger files typically round to 1-2 decimal places for readability.

How do AI agents use byte formatting for file operations?

Agents use it to display file sizes, calculate storage requirements, or report progress during data processing tasks with user-friendly units.

Try Format Bytes Now

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

Get Free API Key