String Utilities

String Length

Counts characters in any string with UTF-8 support for accurate length calculation. Use via MCP in Cursor or Windsurf for instant string analysis, or call GET /v1/string/length with your text. Returns precise character count including emojis and unicode — "Hello 👋" gives 7, not 8 bytes.

API Endpoint

GET /v1/string/length

Code Examples

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

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

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

Learn more about MCP setup →

FAQ

How does string length counting handle unicode and emojis?

Counts actual characters, not bytes. '🚀✨' returns 2, and 'café' returns 4 characters correctly.

Can I use this in MCP-enabled editors for quick string analysis?

Yes, works natively in Cursor, Claude Code, Windsurf, and other MCP tools for instant character counting during development.

What's the difference between this and JavaScript's .length property?

JavaScript can miscalculate unicode. This tool guarantees accurate UTF-8 character counting regardless of string content.

Does it count whitespace and special characters?

Counts all characters including spaces, tabs, newlines, and special symbols. 'hello world' returns 11.

What happens with empty strings or very long text?

Empty strings return 0. Handles large text efficiently without practical length limits.

Try String Length Now

Get your free API key and start using String Length in seconds.

Get Free API Key