AI TOOLS

Use a custom font in a shared HTML page

A brand font that shows on your computer and falls back to Times or Arial once the page is shared. Why the .woff2 file does not travel with the link, the CORS rule fonts follow, and three ways to make the font load for everyone.

4 min read·

Ask Claude or ChatGPT to use your brand typeface and you get a page with an @font-face rule like src: url("fonts/Brand.woff2"). On your computer the font shows, because the fonts folder sits next to the file, or because the font is installed on your machine.

Upload only the HTML file and every viewer sees the fallback: Times, Arial or whatever the font-family list ends with. The page has to point at a font file the link can reach, or carry the font inside it.

Check it the way a viewer sees it

Open the shared link on another device, or in Chrome DevTools open the Network tab, filter by Font and reload. A red row for the font file means it never arrived, and the page is showing the fallback.

Option 1: a Google Fonts link

If the typeface is on Google Fonts, replace the @font-face rule with the <link> tag Google Fonts gives you for that family and weights. Shared pages are served without a Content Security Policy, so the stylesheet and font files load as they do on your computer.

Each viewer's browser then requests the font from Google, which receives their IP address. For a page that must not contact third parties, use option 2 or 3.

Option 2: put the font inside the file

Ask the AI tool to "embed the font as a base64 data URL in the @font-face src". The font becomes text inside the HTML and the file needs nothing else.

Base64 makes the font about a third larger, and one weight is often 30 to 100 KB before that. Embed one or two weights, in WOFF2, not a whole family. Making an HTML file self-contained covers the conversion.

Option 3: upload the font to Media

In the FileShare Pro app, open Media and drop the .woff2 file in. It gets its own URL on r.fileproapp.com; Copy URL puts it on your clipboard. Put that URL in the @font-face src in place of fonts/Brand.woff2, and add font-display: swap so text shows in the fallback while the font loads.

Fonts follow a cross-origin rule that images do not: a page can only use a font from another domain if that server sends an Access-Control-Allow-Origin header. Media sends Access-Control-Allow-Origin: * on every file, so the font loads in the shared page. Tested in Chrome: the same font file loaded from a server that sent the header and failed to load from one that did not.

This is also why a font linked from a personal site, a cloud drive or a raw repository URL often fails in a shared page while images from the same place show.

Media files count toward your storage (1 GB on Free) and are not pages, so they do not count toward your file count. One font file can serve every page you share.

Check the font licence

Hosting a font file at a public URL means anyone with the URL can download it. Fonts from Google Fonts are under open licences that allow this. A typeface bought for desktop use often needs a separate web licence; check the licence before uploading it to Media or embedding it.

Upload the page and send the link

Drag the HTML file onto the dashboard and copy the link. Viewers need no account, and they can leave comments on the page, such as "headline font looks too light on mobile": letting people comment on a web page.

To change the font later, upload the new file to Media, update the URL in the page and upload the new HTML over the old file; the link stays the same: updating a shared link without changing it.

Related: a page with a video file, a photo gallery and why a page that works in chat breaks when hosted.

Frequently asked

Which font format should I upload?

WOFF2. Every current browser reads it and it is the smallest. Convert a .ttf or .otf with a tool such as fonttools (pip install fonttools brotli, then fonttools ttLib.woff2 compress Brand.ttf).

Does a password on the page protect the font file?

No. The password protects the page, not files in Media. A Media URL opens for anyone who has it: password-protecting an HTML page.

Got a page to share?

Drop the file, copy the link — live in seconds, free plan included.

Start sharing free