 <p>That will work <em>if</em> <code>Environment.NewLine</code> is CR+LF, which it's likely to be on Windows. Of course it won't catch the situation where the string actually only contains line feeds, or only contains carriage returns. Perhaps you want:</p> <pre><code>StringBuilder sb = new StringBuilder(s).Replace("\r\n", "&lt;br/&gt;") .Replace("\n", "&lt;br/&gt;") .Replace("\r", "&lt;br/&gt;"); </code></pre> <p>(Note that there's no point in using a verbatim string literal for <code>"&lt;br/&gt;"</code> as there's no backslash in the string, and it's a single line.)</p>