What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Replace character 13 (carriage return, CR or r) with <br> only when your output is HTML and a visual line break is what you intend. First identify whether the input contains CR, LF, or the two-character CRLF sequence; the replacement must match that form.
What chr(13) and <br> mean
Character 13 is the carriage-return character, commonly written as r or U+000D. The HTML <br> element produces a line break in text. It is appropriate when the line division itself matters, such as in a poem or postal address (MDN Web Docs).
<br> is markup, not a replacement for paragraph structure. Do not use repeated <br> elements to create vertical margins between paragraphs; use separate <p> elements and CSS spacing instead.
Check the actual line-ending sequence
HTML recognizes three common newline forms: CR (U+000D), LF (U+000A), and CRLF (CR followed by LF), as specified by the WHATWG HTML Standard.
#1 Best Overall
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
| Input | Typical notation | Replacement to make one HTML line break |
|---|---|---|
| Carriage return | r / character 13 |
Replace the lone CR with <br> |
| Line feed | n / character 10 |
Replace LF with <br> |
| Carriage return + line feed | rn |
Replace the two-character sequence once, before handling lone CR or LF |
If CRLF is processed as separate characters, the CR can become one <br> and the following LF another, producing an unintended double break. Handle CRLF first whenever your input may contain it.
Language-neutral replacement logic
- Determine whether the destination will interpret HTML. If it displays plain text, inserting
<br>will show the literal characters rather than create a break. - Replace every CRLF sequence with
<br>. - Replace any remaining lone CR with
<br>. - If the input convention uses LF, replace remaining LF characters as well.
In pseudocode, the ordering is:
text = replace(text, CRLF, "<br>")text = replace(text, CR, "<br>")text = replace(text, LF, "<br>")when LF is also a line boundary you intend to render
The exact function names and string-literal syntax depend on your programming language, so do not copy this pseudocode as a language-specific program without adapting it.
Rank #2
Python example
Python documents n as line feed, r as carriage return, and rn as their two-character combination. Its str.splitlines() method recognizes CR, LF, and CRLF among line boundaries (Python built-in types documentation).
For Python input where each recognized line boundary should become one HTML break, split into lines and join with the markup:
Recommended Free Tools
Rank #3
html = "<br>".join(text.splitlines())
This approach treats the recognized boundaries as boundaries rather than attempting to replace character 13 alone. If preserving empty lines or trailing line endings is important, use explicit CRLF, CR, and LF replacements instead and test those cases against your input.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.When a paragraph is the right output
If the source uses line endings to separate paragraphs rather than lines within one address, poem, or similar block, convert those logical paragraphs to <p> elements instead of emitting a long sequence of <br> tags. Use CSS to control the space between paragraphs. The choice is about the intended document structure, not merely the numeric value 13.
Quick Recap
Best Value
Rank #4
- Brand: Wiley
- Set of 2 Volumes
- A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
Quick troubleshooting checklist
- Nothing breaks: confirm the destination renders HTML rather than displaying escaped or plain text.
- Every line has two breaks: your CRLF input was probably processed as separate CR and LF replacements; replace CRLF first.
- Some lines remain joined: the source may use LF instead of CR, or a mixture of newline forms.
- Too much vertical space: check whether paragraph spacing, CSS, or duplicate break tags are being added in addition to the converted line ending.
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.




