 <p>Here's a solution for php:</p> <pre><code>function make_uri($input, $max_length) { if (function_exists('iconv')) { $input = @iconv('UTF-8', 'ASCII//TRANSLIT', $input); } $lower = strtolower($input); $without_special = preg_replace_all('/[^a-z0-9 ]/', '', $input); $tokens = preg_split('/ +/', $without_special); $result = ''; for ($tokens as $token) { if (strlen($result.'-'.$token) &gt; $max_length+1) { break; } $result .= '-'.$token; } return substr($result, 1); } </code></pre> <p>usage:</p> <pre><code>echo make_uri('In C#: How do I add "Quotes" around string in a ...', 500); </code></pre> <p>Unless you need the uris to be typable, they don't need to be small. But you should specify a maximum so that the urls work well with proxies etc.</p>