HTML Beautifier Pro

Related Pages: HTML Minifier.

About HTML Beautifier Pro:

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

This tool can force to format invalid HTML String, even if the input String doesn't comply the official HTML syntax properly.

More information about HTML (Hypertext Markup Language):

W3 HTML 5.2 standard:

RFC 7992 (HTML):

Python Implementation of HTML (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