Need online text manipulator to remove carriage returns

I have several articles I want to put on my site, but they are ladden with hard carriage returns for every single line. Does anyone know of an online tool where I could paste in my text, and have it cleaned up?

I need my text to wrap at the size of the web broswer, not where the hard returns are.


This seemed like an interesting task, so I wrote a simple script to do this. Here’s a link to the Text Cleaning Tool.

It’s pretty simple. Copy and paste the article with extra newlines into the top textarea box. Click the button and the cleaned text will appear in the lower box.

I made the script preserve double newline characters, assuming that those would be paragraph breaks.

You could write a script to do this a bunch of ways. This one uses Javascript to take the input (from the textarea), perform a regex search and replace, and then place the cleaned text in a new textarea.

You could also send the form to a php script and do the processing with str_replace().

Good luck,

  • Walkere

I appreciate the time you took to make this tool, unfortunately it didn’t work on the article that I pasted in there. The result was that words were joined together that were not previously joined. Here is an excerpt of what I was trying to convert. Put it into your tool and you will see what I mean.


Vol.1, pp.125-132, by Lynn L. Bishop


Bishop Koyle is often quoted as prophesying that the coming in of the
Dream Mine will be introduced by a heavy Winter, a water-logged Spring,
and a dry, hot summer, and that a mild Fall, a mild Winter, and a
four-year famine would follow. But an analysis of the evidence reveals
that there are a number of inaccuracies and misunderstood aspects of
this sequence. Since it is often easier to see the individual trees of
the forest after one first sees the shape of the forest itself, we shall
first present the conclusions of this analysis, and secondly the
discussion which leads to the conclusions:

Thanks for the tip. The problem seems to be fixed now.

I was replacing the newline characters with blank strings to just strip them out of the text.

I forgot that there was nothing else between the last word of one line and the first word of the next line except the newline - so it really needed to be replaced with a single space character.

  • Walkere

This works perfectly. Is there anyway I can implement this javascript onto my own website?


Sure, feel free. If you view the source of the HTML page, you’ll find a link to the external JS file. Should be pretty self-explanatory.

  • Walkere

To get rid of all formatting in articles I buy that have been created in Word, I simply copy and past into Notepad, then I copy from Notepad and paste into a HTML editor. If I in WYSIWYG mode (Dreamweaver), I get <p> … </p> tages around paragraphs … in code view, I get no tags and have to add them … which I prefer.