How to add a header and footer to a PDF
Adding a header or footer to a PDF means writing one line at the top and another at the bottom of the pages you choose: the document name, a page number, a date. On BestPDFInTheWorld it takes three steps: choose the file, write the lines and apply. You can use placeholders that fill themselves in, {n} for the page number, {total} for the page count, {ficheiro} for the file name, and set the horizontal alignment, size, colour and distance from the margin. Everything runs in your browser: the file never leaves your computer. This tool is part of the Premium subscription, EUR 1.99 a month, which removes the limits on every tool and adds OCR. Sign PDF opens on the free plan, with one signature a day.
Verified 2026-08-12
- Three steps: choose the file, write the lines, apply and download.
- Placeholders {n}, {total} and {ficheiro}: the page number, the count and the file name fill themselves in on every sheet.
- Control over the look: horizontal alignment, size, colour and distance from the margin; long text shrinks to fit, down to a minimum of 4 points.
- No uploads: everything runs in the browser, and the tool keeps working offline once the page has loaded.
- This tool is part of the Premium subscription, EUR 1.99 a month, which removes the limits on every tool and adds OCR. Sign PDF opens on the free plan, with one signature a day.
How to add a header and footer to a PDF, step by step
Adding a header or footer to a PDF means writing one line at the top or bottom of the pages, and it takes under a minute:
- Open the Header and footer tool.
- Drag the PDF into the window, or click to pick it.
- Write the header, the footer, or both. You can leave one field empty, but not both: with nothing to write there is no job to do, and the tool says so instead of handing back an identical file.
- Fine-tune the result: set the horizontal alignment, size, colour and distance from the margin. If you do not want every page, list the ones you want in the pages field, which takes ranges like 2-10 and single numbers, handy for skipping the cover.
- Press apply. The processing runs on your computer, not on a server, and you get the PDF with the lines written on the pages you chose.
Nothing to install, no account and no upload wait. The result appears instantly, with the headers and footers already written into the file.
The {n}, {total} and {ficheiro} placeholders: automatic page numbers
Placeholders are the reason this tool is worth more than simply writing a line. Write {n} for the page number, {total} for the page count and {ficheiro} for the file name, each one fills itself in on every sheet.
For example, writing "Page {n} of {total}" in the footer gives "Page 7 of 42" on page seven, "Page 8 of 42" on page eight, and so on to the end. Without placeholders, whatever you write appears identically on every page, which is rarely what a footer is for: a fixed "Page 1" across two hundred sheets tells you nothing.
Tips for headers and footers
- Accents work. Western Latin covers the accents used in Portuguese, Spanish, French, German and the Nordic languages, plus the euro sign. This was measured, and an automated test guards it.
- Emoji and non-Latin scripts are refused, and for a good reason. The typeface in use cannot write emoji, arrows, Cyrillic, Greek or Chinese. If the tool did not refuse, the library would silently swap every unknown character for a "?" and save the file anyway, you would only find out on opening the PDF and seeing question marks in the middle of the footer across two hundred pages. So the tool refuses and names the characters involved.
- Long text shrinks to fit. When the line does not fit the page width, the font size is reduced until it does, down to a minimum of 4 points. The alternative would be text running off the margin with no warning. Below that minimum the tool refuses, because text you cannot read is no use.
- Line landed on top of the page content? Increase the distance from the margin. The tool writes where it is told: it does not know where the page text ends.
- The typeface is standard, so the file stays light. There is no typeface choice: a standard one is used, which needs no embedding.
- Only need the page number? The Number pages tool does just that, with no questions asked. This one lets you write whatever you want, top and bottom, with colour, size and position of your choosing.
- Want a line at an exact spot? Use the Add text tool. And if the document is missing a signature, Sign PDF sits in the same category.
- This tool adds, it does not remove. A header that is already in the PDF is part of the page content and is not erased.
- It works offline. Since all the processing runs in your browser, once the page has loaded you can add headers and footers with the network off.
Is adding a header and footer free? What are the limits?
This tool is part of the Premium subscription, EUR 1.99 a month, which removes the limits on every tool and adds OCR. Sign PDF opens on the free plan, with one signature a day.
| Plan | What it allows |
|---|---|
| Free plan | Only Sign PDF opens without paying, with one signature a day and files up to 10 MB. |
| Premium (EUR 1.99/month) | This tool is part of the subscription: no limits anywhere, plus OCR and larger batches. |
Questions about headers and footers.
How do I add the page number automatically?
With placeholders, which fill themselves in on every sheet. Write {n} for the page number, {total} for the page count and {ficheiro} for the file name. For example, "Page {n} of {total}" in the footer gives "Page 7 of 42" on page seven. Without placeholders, whatever you write appears identically on every page.
Does it write on every page, or can I choose?
By default it writes on every page. The pages field takes ranges like 2-10 and single numbers, so you can skip the cover, for example.
Can I set only a footer, with no header?
Yes. Leave the other field empty. What you cannot do is leave both empty: with nothing to write there is no job to do, and the tool says so instead of handing back an identical file.
Is it free? What are the limits?
No. This tool is part of the Premium subscription, EUR 1.99 a month, which removes the limits on every tool and adds OCR. Sign PDF opens on the free plan, with one signature a day.
My text came out smaller than I asked for. Is that normal?
Yes, and it is deliberate. When the line does not fit the page width, the tool reduces the font size until it does, down to a minimum of 4 points. The alternative would be text running off the margin with no warning. Below that minimum the tool refuses.
The tool refused my text because of a character. Why?
That happens with emoji, arrows, and scripts outside Western Latin, such as Cyrillic, Greek or Chinese. The typeface in use cannot write them, so the tool refuses and names the characters involved, instead of saving question marks in the middle of your footer.
Are my files kept on your servers?
No. Nothing is sent: the processing runs in your browser, start to finish, so nothing is kept outside your computer.
Keep reading
How to add text to a PDF
Step by step to write a line at an exact spot in the PDF, with the size, colour and angle you choose, without uploading anything.
How to add an image to a PDF
Step by step to place a logo, stamp or signature at an exact spot in a PDF, without losing quality and without uploading anything.
How to extract images from a PDF
Step by step to pull the photos and embedded images out of a PDF, one PNG per image, without uploading anything.
Document missing
its headers?
Open the tool and write them. Nothing to install, nothing sent anywhere.
Open Header and footer