String Utilities

Remove Whitespace

Strips all whitespace characters (spaces, tabs, newlines) from any text string. Use via MCP in Cursor or Windsurf for cleaning user input, or call GET /v1/string/remove-whitespace with your text. Perfect for sanitizing data before validation or creating compact identifiers. Returns the exact input with every whitespace character removed.

API Endpoint

GET /v1/string/remove-whitespace

Code Examples

curl "https://tinyfn.io/v1/string/remove-whitespace" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/string/remove-whitespace', {
  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/remove-whitespace',
    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

What types of whitespace does this remove?

Removes all Unicode whitespace: spaces, tabs, newlines, carriage returns, form feeds, and other whitespace characters like non-breaking spaces.

How do I use this with MCP in my AI coding assistant?

Call the remove_whitespace tool with your text parameter. Works in Cursor, Claude Code, Windsurf, and other MCP-compatible editors for instant text cleaning.

Does this preserve the original character encoding?

Yes, all non-whitespace characters remain unchanged including Unicode symbols, emojis, and special characters. Only whitespace is removed.

What's the difference between this and trim functions?

Trim only removes leading/trailing whitespace. This removes ALL whitespace throughout the entire string, including spaces between words.

Can I use this for creating URL-safe strings?

Partially - it removes spaces but doesn't handle other URL-unsafe characters. You'd need additional URL encoding for complete safety.

Try Remove Whitespace Now

Get your free API key and start using Remove Whitespace in seconds.

Get Free API Key