Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <body> <textarea rows="6" cols="50" name="normalTXT" id="textId"></textarea> <button onclick="convert()">Convert</button> <br /> <URL> Encoding in URL: <input width="500" type="text" name="URL-ENCODE" id="URL-ENCODE" /> <br /> </URL> <html> Encoding in HTML: <input type="text" name="HTML-ENCODE" id="HTML-ENCODE" /> <br /> </html> <script> function htmlDecode(input) { const textArea = document.createElement("textarea"); textArea.innerHTML = input; return textArea.value; } function htmlEncode(input) { const textArea = document.createElement("textarea"); textArea.innerText = input; return textArea.innerHTML.split("<br>").join("\n"); } function convert() { const textArea = document.getElementById("textId"); const HTMLencoded = textArea.value; document.getElementById("HTML-ENCODE").value = HTMLencoded; const urlEncode = htmlEncode(textArea.value); document.getElementById("URL-ENCODE").value = urlEncode; } </script> </body> </html>