Cleans up messy text by converting multiple consecutive spaces, tabs, and newlines into single spaces. Access via MCP in Cursor or Windsurf for AI-powered text processing, or hit GET /v1/string/normalize-whitespace directly. Perfect for sanitizing user input or preparing text for consistent formatting—handles Unicode whitespace characters beyond just ASCII spaces.
curl "https://tinyfn.io/v1/string/normalize-whitespace" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/string/normalize-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/normalize-whitespace',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
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"
}
}
}
}
Handles all Unicode whitespace: spaces, tabs, newlines, carriage returns, non-breaking spaces, and other Unicode space characters. Converts consecutive whitespace sequences to single ASCII spaces.
Call the tool from Cursor, Windsurf, or other MCP clients to clean text before processing. Useful when AI agents need to standardize user input or prepare text for consistent analysis.
No, it trims leading and trailing whitespace entirely. Only internal whitespace between words gets normalized to single spaces.
Trim only removes leading/trailing spaces. Normalize-whitespace also collapses internal whitespace sequences (multiple spaces, mixed tabs/spaces) into single spaces throughout the text.
Yes, the tool handles large inputs efficiently. Send via REST API for batch processing or use MCP for real-time text cleanup in development workflows.
Get your free API key and start using Normalize Whitespace in seconds.
Get Free API Key