Customizing Firefox Headers and Footers

When printing to paper or saving PDF files from Firefox, you can customize the headers and footers to suit your needs. For example, when I save PDFs of web pages, I prefer to have the page title at the top, the page number at top right, and the URL across the bottom. This maximizes the space for these details and aids future reference and citation.

When Firefox is first installed, the header/footer defaults are set to:

HEADER: Page Title … URL

FOOTER: Page # of Total … Date/Time

As you can see, this does not leave much room for either the Page Title or URL. The Date/Time is simply when the file was created and not when the web page or article was published. You can always add this information to the filename (I use a modified DayMonthYear date style to minimize the number of characters: 15apr2022).

The following may look very technical, but it is not really difficult. You cannot break anything if you stick to the print.print settings I have listed. At worst you might have headers/footers in places you don’t want. They can be fixed. Often, this is a one-and-done operation, but you may need to go back and tweak your edits.

This is best accomplished by using Firefox’s “about:config” settings editor. I will list the settings by name and then provide the codes at the end. Below is the official Mozilla page regarding “about:config” for your reference.

Here is the short version:

  1. Type about:config into your URL bar and press return (enter).
  2. Accept the warning and continue.
  3. Type print.print in the search box at the top.

As you type, the settings will be filtered down to a much shorter list. The main browser defaults you need to edit are (as they appear alphabetically in about:config):


Please note that this order does not match how they appear on the printed page. This is probably the most difficult part: Paying attention to which header or footer position you are editing. :face_with_spiral_eyes:

There will also be a set of these for each printer device. For example …


… as well as a set for Firefox’s newer “Save to PDF” feature …


Once you set your browser defaults it will be applied to any other printing device when they are first used (created), but you may need to check them. Any printing devices already loaded will need to be edited if you want different options.

Just remember that any edits you do should be permanent and you will not have to do this again.

Usually the Firefox default for the top, left header is to print the web page title. This setting in about:config looks like this:

print.print_headerleft &T

(You will see a large gap between the setting and the “&T” code.)

In each position you may edit the “&” code to automatically insert the result you want. You can also delete the code and leave it blank so it is ignored when printing. This means any position with no code will print nothing and the code to the left may use that space.

  1. Click the pencil icon (far, right end of that row).
  2. Edit the code. When ready, click the checkmark icon that is in the same place where the pencil was. This will save your edit.

Here are the available “&” codes:

&D = Date (when saved)
&P = Page Number in saved file
&PT = Page Number with Total (“3 of 5”)
&T = Page Title (from web site)
&U = URL (http address of web site)

Be sure there are NO spaces and that all letters are CAPITALIZED.

Edits should take effect immediately and before you close about:config. So you can leave a tab open to about:config and another for print testing. If your desired results do not show in a test print, the changes may not have been saved or you may have mis-typed the code (both are easy to do). Just re-check your work, being careful to change the set that is named the same.

A 3rd possibility is that you just edited the wrong set (ie. a different print device). My Firefox profile has been in use for a very long time across many versions of Firefox. As an early adopter, the initial “Save to PDF” settings did not use the browser defaults, so I just had to manually edit both. Now everything works 100% of the time.

Just remember that you can fix any edit. If you are uncertain, click the curved arrow icon (far, right end of the about:config row) and the setting will be reset to default. Pay attention to which row you do this on as some settings have a little trash can icon that deletes them. Many of these are for extra features that can be re-created by the software again later, but it is best to avoid deleting anything.

[EDIT: spelling fix]