Google Fonts CSS Generator
Families & weights
Suggested families: Inter · Fraunces · Playfair Display · Lora · Source Serif 4 · Merriweather · Space Grotesk · DM Sans · Manrope · Poppins · JetBrains Mono
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&family=Fraunces:wght@400;700&display=swap" rel="stylesheet" />font-family: "Inter", sans-serif;
font-family: "Fraunces", sans-serif;URL
https://fonts.googleapis.com/css2?family=Inter:wght@400;700&family=Fraunces:wght@400;700&display=swap
You Might Also Need
The Google Fonts CSS generator turns a family and weight selection into a valid CSS2 API URL, the link tags that use it, and the CSS that applies the result. The ordering rules it implements are the ones the API actually enforces.
What is Google Fonts CSS Generator?
The Google Fonts CSS generator builds a CSS2 API URL from a list of families, a set of weights and a display policy, then writes the link tags and the usage rules that go with it. The URL has rules that are easy to get wrong by hand, and the tool encodes them.
The encoding rules the generator applies:
- Family names are joined with plus signs, and each family becomes its own parameter in the query string.
- Weight tuples are sorted ascending, because the API requires the order it documents and rejects a list that arrives shuffled.
- Italic styles are expressed as ital,wght tuples, sorted first by the italic flag and then by weight, so a normal 400 and an italic 400 are two distinct entries.
- The display parameter is appended once for the whole request, not per family.
The sorting rule is the one that costs people time, because a hand-written URL usually works until a weight is added and then starts returning an error with no useful message. The generator reports the number of families, the number of weight tuples and the length of the resulting URL, and the last of those is a rough proxy for the cost of the request: a URL asking for four families across five weights is describing a lot of files, even though it is a single link tag.
Alongside the URL, the tool writes the tags to paste into the document head. Two preconnect hints come first, one for the stylesheet host and one for the file host with the crossorigin attribute, and the stylesheet link follows. The preconnects are not decoration: without them the browser discovers the font host only after parsing the stylesheet, which puts a DNS and TLS handshake on the critical path at the worst possible moment. The usage block then writes one declaration per family, choosing a monospace fallback when the family name contains mono and a sans-serif one otherwise, which is a guess rather than a measurement but a better default than nothing. A family whose name contains a space is quoted in the declaration, which is the detail a hand-written usage rule most often misses.
The request has limits that the API itself does not have, and they are worth knowing before the URL is pasted.
- No variable axes or optical sizing can be requested, so a variable family has to be specified weight by weight, which costs more files for the same visual result.
- There is no text parameter, so a request cannot be subset to the characters a page actually uses — a technique that makes the smallest possible download for a heading-only face.
- The weight list holds five values from 300 to 700, which covers most interface work but not a family whose light or black weights are the point.
- Nothing validates a family name against the service, so a typo produces a URL that fails at runtime with the fallback silently appearing instead.
- The usage declarations guess their generic family from the name, which is a reasonable default rather than a match for the project's own stack.
How to use Google Fonts CSS Generator
- Enter one family name per line, taking names from the suggested list unless the family is known to exist on the service.
- Select the weights, and include italics only when an italic style is genuinely used, since each one adds tuples to the request.
- Choose the display policy, then copy the three head tags in order so the preconnects come before the stylesheet link.
- Paste the usage declarations and replace the guessed generic family with one that matches the design's fallback stack.
When to use Google Fonts CSS Generator vs related tools
Reach for it when a Google Fonts request has to be written correctly rather than by trial and error, when a stylesheet link is returning an error after someone added a weight, or when a page needs the preconnect pair explained and placed. The ordering rules are the part that saves a debugging session. For self-hosted files instead of a hosted request, the font-face generator writes the declarations and the font loading strategy builder sets the budget; to choose the faces themselves, the font pairing suggester and the Google Fonts pairing picker work on the same catalogue.
Privacy & Security
This tool runs entirely in your browser — no data ever leaves your device. There is no server round-trip, no upload, no logging, and no account required. Your input is processed locally using client-side JavaScript and is never stored, transmitted, or accessible to anyone else. When you close the tab, everything disappears.