*   [](/v0.2/)
*   [How-to guides](/v0.2/docs/how_to/)
*   How to load HTML

On this page

How to load HTML
================

The HyperText Markup Language or [HTML](https://en.wikipedia.org/wiki/HTML) is the standard markup language for documents designed to be displayed in a web browser.

This covers how to load `HTML` documents into a LangChain [Document](https://api.python.langchain.com/en/latest/documents/langchain_core.documents.base.Document.html#langchain_core.documents.base.Document) objects that we can use downstream.

Parsing HTML files often requires specialized tools. Here we demonstrate parsing via [Unstructured](https://unstructured-io.github.io/unstructured/) and [BeautifulSoup4](https://beautiful-soup-4.readthedocs.io/en/latest/), which can be installed via pip. Head over to the integrations page to find integrations with additional services, such as [Azure AI Document Intelligence](/v0.2/docs/integrations/document_loaders/azure_document_intelligence/) or [FireCrawl](/v0.2/docs/integrations/document_loaders/firecrawl/).

Loading HTML with Unstructured[​](#loading-html-with-unstructured "Direct link to Loading HTML with Unstructured")
------------------------------------------------------------------------------------------------------------------

    %pip install "unstructured[html]"

    from langchain_community.document_loaders import UnstructuredHTMLLoaderfile_path = "../../../docs/integrations/document_loaders/example_data/fake-content.html"loader = UnstructuredHTMLLoader(file_path)data = loader.load()print(data)

**API Reference:**[UnstructuredHTMLLoader](https://api.python.langchain.com/en/latest/document_loaders/langchain_community.document_loaders.html.UnstructuredHTMLLoader.html)

    [Document(page_content='My First Heading\n\nMy first paragraph.', metadata={'source': '../../../docs/integrations/document_loaders/example_data/fake-content.html'})]

Loading HTML with BeautifulSoup4[​](#loading-html-with-beautifulsoup4 "Direct link to Loading HTML with BeautifulSoup4")
------------------------------------------------------------------------------------------------------------------------

We can also use `BeautifulSoup4` to load HTML documents using the `BSHTMLLoader`. This will extract the text from the HTML into `page_content`, and the page title as `title` into `metadata`.

    %pip install bs4

    from langchain_community.document_loaders import BSHTMLLoaderloader = BSHTMLLoader(file_path)data = loader.load()print(data)

**API Reference:**[BSHTMLLoader](https://api.python.langchain.com/en/latest/document_loaders/langchain_community.document_loaders.html_bs.BSHTMLLoader.html)

    [Document(page_content='\nTest Title\n\n\nMy First Heading\nMy first paragraph.\n\n\n', metadata={'source': '../../../docs/integrations/document_loaders/example_data/fake-content.html', 'title': 'Test Title'})]

[Edit this page](https://github.com/langchain-ai/langchain/edit/master/docs/docs/how_to/document_loader_html.ipynb)

* * *

#### Was this page helpful?

  

#### You can also leave detailed feedback [on GitHub](https://github.com/langchain-ai/langchain/issues/new?assignees=&labels=03+-+Documentation&projects=&template=documentation.yml&title=DOC%3A+%3CPlease+write+a+comprehensive+title+after+the+%27DOC%3A+%27+prefix%3E).

[

Previous

How to load documents from a directory

](/v0.2/docs/how_to/document_loader_directory/)[

Next

How to load JSON

](/v0.2/docs/how_to/document_loader_json/)

*   [Loading HTML with Unstructured](#loading-html-with-unstructured)
*   [Loading HTML with BeautifulSoup4](#loading-html-with-beautifulsoup4)