Save Web Pages As Single HTML Files For Offline Use With Monolith (Console)

Monolith is a command line tool to save any web page as a single HTML file that contains everything needed to render web page locally, without needing a working Internet connection.

Use this to save web pages containing documentation, wiki articles, and anything else that interests you, for local/offline use. Since the web pages are saved in plain HTML, use a tool that can search in files to quickly find the web page you're looking for.

Unlike the regular "Save page as" (or Ctrl + s) option provided by web browsers to save web pages to your computer, which saves web page assets in a folder next to the saved web page, this command line tool retrieves the web page assets and converts them into base64 data URLs, using that in the document instead of the regular URLs. As a result, page assets like Javascript, CSS or images are embedded in the page HTML, so all you need is a web browser to access the locally saved web page.

The tool also provides 2 useful options: -i to remove images from saved web pages, and -j to exclude JavaScript.

Monolith initially used Node.js, but it was very recently (about 11 hours prior to publishing this article) rewritten in Rust. Currently, it works well for basic pages, but there are still a few things that need work. For example, embedding CSS imports and web fonts is not currently supported, though it appears that the developer plans on implementing this soon. With Monolith 2.1.0, CSS imports and web fonts are supported, so such elements are embedded into the saved HTML file.

Saving web pages that require authentication does not currently work. Also, saving embedded videos doesn't work, but that wouldn't exactly be feasible anyway since embedding a video as a data URL would result in a very large HTML file, and if you'll want to edit the HTML file it would be a pain.

It's also worth noting that Monolith saves what's on a web page when it is loaded, so it won't work well with websites that implement infinite scroll, especially since this is usually implemented differently depending on the website (in my test, only the initial article was saved in such cases). It doesn't seem to handle too well web pages that make use of lazy loading either.

The idea of saving any web page as a single file with all assets embedded is not new, and there are quite a few alternatives out there. For example, Safari web browser lets you save individual web pages for offline viewing by storing all the elements of the page in a web archive (.webarchive file extension). There's also MHTML, a web archive format that similarly saves web pages in a single file.

But these have some limitations, like requiring the use of a particular browser or third-party client to save of view them. For example, you can only save and view .webarchive files using Safari web browser and some third-party solutions. As for MHTML, it's no longer supported by Firefox, and Google Chrome recently removed the custom #save-page-as-mhtml flag that previously allowed it to save web pages as MHTML (there might be some extensions that bring back this functionality, I didn't check).

Since Monolith saves web pages as regular HTML files, you can use any web browser to view them. This means you don't rely on any third-party solutions, and you don't need web browsers to continue supporting a particular web archive format, future-proofing your locally saved web pages.

You might also like: Browse Wikipedia Offline With WebArchives For Linux

Monolith Linux installation and usage

To install Monolith we'll use Cargo, Rust's build system and package manager. You'll also need to install OpenSSL (devel) to be able to build Monolith. Install these on Linux using:

  • Debian / Ubuntu / Linux Mint / Pop!_OS, etc.:
sudo apt install cargo libssl-dev

  • Fedora:
sudo dnf install rust-cargo openssl-devel

  • Arch Linux, Manjaro:
sudo pacman -S rust openssl

  • openSUSE:
sudo zypper install cargo libopenssl-devel

  • Solus OS:
sudo eopkg install cargo openssl-devel

Now you can get the Monolith source from Git and install it:

git clone
cd monolith
cargo install

The Monolith binary is installed in ~/.cargo/bin, which is not in your $PATH by default. You can add it to your PATH (so you can type "monolith" without its full path to use it) by adding export PATH="$PATH:$HOME/.cargo/bin to your ~/.bashrc or ~/.zsh file (depending on what you're using). You can do this and source ~/.bashrc / ~/.zsh using:

  • for Bash:
echo "export PATH=\"\$PATH:\$HOME/.cargo/bin\"" >> ~/.bashrc
. ~/.bashrc

  • for Zsh:
echo "export PATH=\"\$PATH:\$HOME/.cargo/bin\"" >> ~/.zshrc
. ~/.zshrc

Make sure to only run the "echo" command once, because it adds export PATH="$PATH:$HOME/.cargo/bin to ~/.bashrc / ~/.zsh each time you run it.

Now you can start using Monolith to save web pages with their resources embedded in a single HTML file. For example let's save the Monolith GitHub web page ( locally, in a file called monolith.html:

monolith > monolith.html

Want to remove JavaScript from the page? Append -j, like this:

monolith -j > monolith.html

In the same way, use -i to remove images from the saved web page.