HTML Beautifier Online Tool



About HTML Beautifier Online Tool:

This online html beautifier tool helps you to format raw HTML file so it can easily be read by human being.

comic html beautifier

Does HTML Beautifier Online Tool log my data?

Absolutely NOT, this HTML Beautifier doing all the formatting work on the client side, all logic are implemented by Javascript. There are 2 major advantages: 1.Your data never transmitted in the Open Internet, so you know it's secure; 2.It's much faster than doing all the work in the server side, because there is no Internet Delay.

More information about HTML (Hypertext Markup Language):

W3 HTML 5.2 standard: https://www.w3.org/TR/html5/

RFC 7992 (HTML): https://tools.ietf.org/html/rfc7992

Python Implementation of HTML (BeautifulSoup): https://www.crummy.com/software/BeautifulSoup/

HTML Formatter with Python (with package BeautifulSoup):

def html_beautify(input_str):
    input_str = BeautifulSoup(input_str, 'html.parser').prettify()
    result = ''
    indent_str = '    '
    for line in input_str.split('\n'):
        lstrip_line = line.lstrip(' ')
        indent_len = len(line) - len(lstrip_line)
        formatted_line = indent_len * indent_str + lstrip_line
        result = result + formatted_line + '\n'
    return result