Convert DOCX to HTML programmatically with inlined images

Kostas, Developer

You must have heard that custom web development requires some programming skills. You need to know at least the basics of HTML, CSS, and JavaScript. Well... Not really. You can actually create a webpage using a well-known and familiar to many - MS Word! Suppose you know how to put together a Word document using tables, images, fonts, and other styling options. In that case, you can create a custom webpage that can be viewed inside a browser - just like any other webpage. This conversion can also be helpful if you want to display your MS Word documents on your website accessible via browser, with no MS Office installed. ConvertAPI helps convert your DOCX files to HTML programmatically with some neat features described in this article.

If you want to make a simple conversion without advanced parameters, a single CURL command should do it:

curl -F "File=@/path/to/my_file.docx" -F "StoreFile=true"

What makes our converter outstanding

DOCX files are based on Open XML format, storing your data in multiple files and folders inside a zip archive, which essentially means that the data is plain text and can be read and interpreted by machines and applications. Websites use HTML markup to present text and graphics, which can be generated from the DOCX file structure.

Many DOCX to HTML converters allow you to convert the Word document to a webpage while extracting the assets into a separate folder but using ConvertAPI, you can choose to embed all the necessary files into a single HTML file. Images inlined into the HTML file as base64 encoded strings make it simple for you to host a single file on a web server - you don't need to host those images separately and manage the external references. Setting the InlineImages property value to true produces a single HTML file that is easy to share, preview, and host on a server.

Alternatively, if you care about the produced HTML file size, you can still extract the assets by setting the InlineImages to false. The output HTML file will become much smaller in size, but it may lose some styling and formatting. If you choose to extract your assets from the HTML file, you will receive a ZIP archive containing all the necessary files for your webpage. If you want to keep the images visible in your HTML, you will need to host those images together with your HTML file.

Real-life examples

Let's see some real-life examples to test how well our DOCX to HTML converter performs without any coding:

If you want to test your own file, you can upload your DOCX and receive the HTML using our online demo tool: Simply sign up for a free account and you will gain access to all features.


ConvertAPI is a cloud-based service that allows you to convert DOCX to HTML without installing additional software via an API call. Great news if you are a .NET, Java, Python, Ruby, PHP, Go, or NodeJs developer, we have libraries for you! This can also be easily achieved using our CLI and Zapier utilities. Otherwise, use simple HTTP requests to our conversion endpoint. All conversion properties and information can be found on the DOCX to HTML API page. Set up your conversion using our interactive demo tool, and you will find an auto-generated code snippet at the bottom of the page! Can't be simpler, right?