What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
A carriage return or line feed in an ASP string does not automatically create a visible line break in an HTML page: the browser normally collapses ordinary whitespace. For readable multiline text, keep the content HTML-encoded and apply white-space: pre-wrap, or encode it first and then convert normalized newlines to trusted <br> elements.
First identify which ASP you are using
- Classic ASP: usually a
.asppage with VBScript between<% ... %>and output such asResponse.Write. - ASP.NET Web Forms: usually an
.aspxpage with server controls andrunat="server". - Razor: typically a
.cshtmlor.vbhtmlpage with@expressions.
The examples below distinguish these technologies; their syntax and encoding helpers are not interchangeable. Classic ASP combines server-side script with HTML returned to the browser, and Response.Write writes text to the HTTP output (Microsoft’s Classic ASP overview; Response.Write reference).
Recommended for ordinary text: preserve newlines with CSS
For comments, form submissions, descriptions, and other text, leave line breaks in the text and tell the browser how to render whitespace. This avoids constructing HTML from the content.
<div class="multiline"><%=Server.HTMLEncode(value)%></div>
<style>
.multiline {
white-space: pre-wrap;
overflow-wrap: anywhere;
}
</style>
Server.HTMLEncode makes markup characters in the value display as text rather than executable HTML. pre-wrap preserves newlines and runs of spaces while allowing long lines to wrap. The optional overflow-wrap helps with long unbroken strings. CSS controls the rendering; this is not an ASP-specific feature. See the MDN reference for white-space.
Recommended Free Tools
#1 Best Overall
Classic ASP: convert newlines to HTML breaks
Use this when the template requires explicit line-break elements. Normalize the line endings first, HTML-encode the content, and only then add trusted <br /> markup:
<%
Function HtmlWithBreaks(ByVal value)
Dim text
If IsNull(value) Then
HtmlWithBreaks = ""
Exit Function
End If
text = CStr(value)
text = Replace(text, vbCrLf, vbLf)
text = Replace(text, vbCr, vbLf)
text = Server.HTMLEncode(text)
text = Replace(text, vbLf, "<br />")
HtmlWithBreaks = text
End Function
Response.Write HtmlWithBreaks(rs("description"))
%>
For data known to contain CRLF only, the shorter form is:
<%=Replace(Server.HTMLEncode(rs("description")), vbCrLf, "<br />")%>
That shortcut will not replace LF-only or CR-only endings. Do not insert breaks into untrusted text and then encode the whole result: encoding afterward turns the trusted tags into visible text. Conversely, writing unencoded form or database content can allow injected markup or script-capable HTML. Microsoft advises encoding client-supplied data before writing it to an HTML response (HttpResponse.Write and output encoding).
Choose the rendering method that fits the content
| Need | Use |
|---|---|
| Ordinary user-entered prose with newlines | HTML-encoded text plus white-space: pre-wrap |
| Explicit breaks in an existing HTML layout | Encode text, normalize line endings, then replace LF with trusted <br /> |
| Preserve line breaks but collapse repeated spaces and tabs | white-space: pre-line |
| Code, logs, or data where spacing matters | Encoded text in <pre>, or pre-wrap if long lines should wrap |
| A static break authored by the developer | A literal <br /> in the HTML |
white-space: pre preserves whitespace but disables ordinary wrapping, so long lines can overflow. A <pre> element also preserves whitespace and is often styled in a monospace font; it suits code and logs better than normal prose. Regardless of element or CSS, encode untrusted text. The distinctions among these CSS values are documented by MDN.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteWhat CR, LF, and CRLF mean
| Form | VBScript representation | Meaning |
|---|---|---|
| CR | vbCr or Chr(13) |
Carriage return |
| LF | vbLf or Chr(10) |
Line feed |
| CRLF | vbCrLf |
CR followed by LF; common in Windows text |
Imported text can use CRLF, LF alone, or CR alone. Replacing only vbCrLf works only when that exact sequence is present. The robust conversion above maps CRLF and lone CR to LF, then replaces every LF with a break.
vbCrLf is a string sequence, not an instruction to the browser to draw a line break. For example, Response.Write "One" & vbCrLf & "Two" may put a newline in the generated HTML source, but ordinary HTML whitespace rules do not guarantee a visual break. Response.Write "One<br />Two" emits HTML that does. A newline in page source and a rendered line break are different things; Classic ASP documentation shows that Response.Write can emit HTML such as <BR> (Classic ASP page and output examples).
Rank #3
ASP.NET Web Forms and Razor equivalents
Web Forms
For plain text, use an encoding-capable literal and apply the same CSS approach. For example:
<asp:Literal ID="DescriptionLiteral" runat="server" Mode="Encode" />
Place the control in an element with the multiline class, and assign its text value in server-side code. If converting newlines to breaks instead, encode the value before adding only the trusted <br /> tags.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Razor
Razor normally HTML-encodes expressions. That is desirable for text, so a CSS rule such as white-space: pre-wrap is usually the simpler option. If you deliberately turn newlines into HTML breaks, account for Razor’s encoding behavior: ordinary encoded output will display the tags as text, while output treated as markup requires a controlled, safe conversion. Do not mark arbitrary user input as raw HTML. Microsoft explains the distinction between encoded expressions and intentionally emitted markup in its Razor syntax guide; Web Pages also documents Server.HtmlEncode.
Troubleshoot when the break still does not appear
- Check the output context. A normal
<div>collapses whitespace by default; a textarea, preformatted element, plain-text response, and HTML email have different display rules. - Check whether the string contains actual control characters. The literal text
rnis four visible characters, not a CRLF sequence. - Check which newline is present. A replacement for
vbCrLfwill not match lone LF or CR. - Check the CSS. A rule setting
white-space: normalon the element overrides the preservation you expected. Trypre-wrap. - Check encoding order. If you encode after inserting
<br />, the browser will display the tag literally. - Check the data path. A database driver, import step, or sanitization routine may have removed the breaks before the page receives the value.
- Distinguish source from display. A newline visible in View Source does not prove the browser will render a new line.
To inspect actual CR and LF characters temporarily in Classic ASP:
<%
Dim debugText
debugText = Replace(text, vbCr, "[CR]")
debugText = Replace(debugText, vbLf, "[LF]")
Response.Write Server.HTMLEncode(debugText)
%>
If the markers are absent, the value does not contain those control characters at that point in the code. If the value contains literal backslash sequences and the input format explicitly defines them as escapes, convert them before normal newline handling:
value = Replace(value, "rn", vbLf)
value = Replace(value, "n", vbLf)
value = Replace(value, "r", vbLf)
Only do this for a format that uses literal escape sequences; replacing every literal n can alter legitimate text.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteTextarea, blank lines, and other output contexts
A <textarea> preserves multiline editing input. When that value is later rendered into an ordinary <div>, use encoded text with white-space: pre-wrap or the normalized break-conversion function; the textarea’s behavior does not carry over to the div.
Converting consecutive newlines produces consecutive breaks and therefore visible blank lines. Decide whether those lines mean extra spacing, a paragraph boundary, or should be suppressed. If a value ends in CR or LF, conversion can also create an empty final line; remove only the terminal newline if that is not meaningful, rather than trimming all whitespace and potentially deleting indentation.
If stored content already contains <br />, encoding it will display the tags literally. That is normally the safe behavior for untrusted text. Legacy content intentionally stored as HTML needs a deliberate HTML-sanitization policy; newline conversion alone does not make it safe. In a plain-text HTTP response or plain-text email, keep text newlines rather than inserting HTML tags. In an HTML email, use the same encode-then-break or CSS strategy appropriate to the renderer. JavaScript and JSON strings have their own escaping rules and should not be rendered as HTML without context-appropriate encoding.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

