are escaped locally.","url":"https://voritools.com/htmloutjs/","applicationCategory":"DeveloperApplication","operatingSystem":"Any","inLanguage":"en","isAccessibleForFree":true,"offers":{"@type":"Offer","price":"0","priceCurrency":"USD"},"browserRequirements":"Requires a modern browser with JavaScript enabled"}
Paste HTML to get document.writeln() statements you can drop into a script, or paste JavaScript that already contains them to read the HTML back. The conversion runs in your browser and the pasted code is never executed.
Runs locally in your browserThe box works in both directions. HTML to JS wraps every line of the pasted markup in a document.writeln("...") statement that can be dropped into a script block; JS to HTML reads those statements back and returns the text they would print.
The conversion runs in the page with browser JavaScript. The input is treated as text - it is never executed - and nothing is uploaded, so internal markup can stay on your machine.
A backslash becomes \\, a double quote becomes \" and the sequence </script> is written <\/script> so it cannot end the surrounding script element. The line separators U+2028 and U+2029 are escaped the way a JavaScript engine expects.
Everything else is kept as typed: single quotes, tabs, accented letters and emoji stay as they are, so save the embedding page as UTF-8.
The reverse direction recognizes document.writeln("...") and document.writeln('...') with the usual escapes (quotes, backslashes, \n, \t, \uXXXX and similar) and replaces each call with the text it would print.
It is a reader, not a JavaScript engine: code is never executed, and constructs it does not recognize - document.write without ln, template literals, or calls built from variables - pass through unchanged.
Typical uses: reviving markup from an old page that wrote HTML through document.writeln, preparing a snippet that has to sit inside a <script> block, or checking what a generated call would actually output.
If you need a JavaScript string array instead of writeln calls, use the sibling HTML to JavaScript tool; it covers the array format and plain string literals.