Convert HTML to AMP for Free using these Tools

Editor Ratings:
User Ratings:
[Total: 1 Average: 3]

Here are a few tools that you can use to convert HTML to AMP for free. These tools I have mentioned in this post take HTML code from you as input and return the corresponding AMP code in output. You can use them directly on your PC from the command line and generate AMP code on the fly. The final AMP code needs a little bit of tweaking though but that’s alright. The tools I have mentioned here are open source and you can modify their source code if you have knowledge of programming to make them generate AMP code in the way you want.

AMP stands for Accelerated Mobile Pages. These are the special versions of webpages of your own website that are highly optimized for mobile devices. They are extremely fast and load the entire content (with or without ads) in blink of an eye. The problem is that the web servers do not generate these pages automatically. You need some tools or CMS plugin to generate an AMP version of your web pages. And in this post, I have added 2 such tools that you can use. Although if you use WordPress like CMS then you don’t really need them as WP offers some community plugins to do that for you.

Convert HTML to AMP for Free

2 Free Tools to Convert HTML to AMP for Free:


AMPTools-Gen is basically a Python script that you can use to instantly generate AMP code from any HTML. It takes a path of inputting HTML file from you and the path to the file that you want to save AMP code to. You can run it directly from command line and you can also further extend to run it as an API

This script relies on a Python library which you will have to install first. So, you just need to follow the steps below to get started with this tool.

  1. Open Command Prompt and then type the following command. It will install the AMP Tools library. You have to make sure that you have Python installed.
    pip install amp_toolspip install amp_tools
  2. Get the script from this GitHub Gist. You can save it anywhere in the PC.
  3. Now, you navigate the command prompt to the folder where you have the save the script. Also, move the HTML file to the same folder that you want to convert to AMP.
    AMPTools-Gen in Folder
  4. Execute the script like this. Specify the name of the input HTML file and output AMP file. It will hardly take a few seconds and will generate the final AMP file at the specified destination. This is as simple as that. [Input HTML File] [Output AMP HTML File]
    AMPTools-Gen in Action
  5. Done.

In this way, you can make use of this simple script to quickly generate HTML to AMP for free. Just install and use this script

Amp-Library by Lullabot

Amp-Library by Lullabot is another free tool that you can use to convert HTML to AMP. This is basically a PHP library and you can use it from the command line as well. It also takes an HTML file and then returns the corresponding AMP code that you can copy. In addition, you can use it as a library in your web applications. Apart from converting entire HTML file to AMP, you can use it to a specific HTML tag to AMP as well.

Using it is very simple from command line. You just need to have composer installed on your PC or server. After that, you just have to follow these steps.

  1. Clone the GitHub repository of this library from the link above.
  2. Now, you just open the command prompt window or terminal window in the folder where you have cloned the repository.
    PHP Lullabot Library Cloned
  3. Run this command to complete the dependencies: composer install
    composer install lullabot amp library
  4. Use it like this. You just have to enter the path to the HTML file that you want to convert. It will leave the AMP code in the command window. You can see this in the screenshot below.
    php amp-console amp:convert [Input HTML File] --full-document
    PHP Lullabot Library in Action
  5. Done.

In this way, you can make use of this simple PHP library to quickly generate AMP code from HTML. If you are a programmer then you will understand it easily. You can create CMS plugins using it and make life of polishers easier.

Final thoughts:

These are the best free tools that you can use to convert HTML to AMP for free. The good thing is that both these tools are open source and you use them on your own PC and your own data. If you have never used command line tools before then these can be intimidating at first. But if you follow the steps mentioned carefully then I am sure you will be able to use them very easily.

Editor Ratings:
User Ratings:
[Total: 1 Average: 3]

Leave A Reply


Get 100 GB FREE

Provide details to get this offer