Versatile HTML compression.


It is a Perl script to parse web pages before publishing. User-defined place-holders of macros can be expanded. Invisible comments and extra whitespace can be removed. Being Perl, it is essentially freely programmable to suite your website.

How do I use htmlXPress?

You copy the configuration file to the directory of your HTML source files and edit it. Here you define your own macros and general search and replace patterns. You also specify into which folder the result files should be saved to.

Site-specific settings can be defined through different config files in separate source folders.

Whenever an HTML file is ready for publishing you "compile" it with htmlXPress. In Mac OS X, you can do that directly from the command line in the Terminal:

% htmlXPress myfile.html

Alternatively, you can drag and drop your HTML file onto the htmlXPress icon. This is possible by using a MacPerl droplet (Mac OS 9) or DropScript (Mac OS X).


Better automation can be achieved using make. For example, you may use a rule similar to this in your Makefile:


# Use htmlXpress to process .html files:
$(OUT)/%.html : %.html
	$(HXP) -out $(OUT) $<
	@chmod 644 $(OUT)/$(@F)


If you do not have Mac OS X, you will need a custom installation of Perl, such as MacPerl which has been ported to the Mac by Matthias Neeracher.

The latest version of MacPerl can be obtained at:


This neat little utility is the brainchild of Wilfredo Sánchez. It can be obtained at


Version 4.0
01 April 2015
Language: English

Other Info

Version History

htmlXPress is programmed in Perl. A basic knowledge of Perl and regular expressions is needed.


Mac OS X (any version):

v4.0 on GitHub

For Mac OS 7 through 9.x when used through MacPerl:

v2.2 (136 KB)
v2.0 (80 KB)

Usage Examples

Find Broken Links

Since version 2.2, htmlXPress can verify that all hyperlinks are still valid.

Compress CSS

Cascading style sheets can be compressed in much the same way (For an example, look at this one).

Remove Unnecessary Code

Example: look at the source of this page (Safari: Develop > Show Page Source).

Simplify HTML

You can define flexible macros for you own needs. For instance you could us a macro such as <:font 1:> which can be expanded to something like <font size=1 face="Verdana, Arial, Helvetica, sans-serif">.

Advanced Usage

You are not limited to search and replace patterns. Using foreach loops and other commands, you can define complex code that builds up a section of your pages automatically.

Example: A loop that will create an HTML table with the data from your source file.