Home/Tools/Typography/Google Fonts Generator
Typography · Generator

Google Fonts Generator

Select and combine multiple Google Fonts with weight/style variants and get the full import code.

Select Font

Weights

Preview — Poppins

loading...
24px
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
Generated CSS
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400,700&display=swap');

/* Apply the font */
body {
  font-family: 'Poppins', sans-serif;
}

/* Available weights */
.font-400 { font-weight: 400; }
.font-700 { font-weight: 700; }
100%
Free, no
sign-up needed
0
Code written
by hand
85+
CSS tools
in one place
<1s
Copy-ready
CSS instantly
What is this

What is the Google Fonts Generator?

Build your Google Fonts @import URL by selecting fonts and weights. Preview the font before generating the optimized embed code.

Everything runs locally in your browser. Adjust the controls above, preview instantly, and copy clean, production-ready CSS — no account, no upload.

How to use

Using the Google Fonts Generator

Everything lives in the panel at the top of this page. There is nothing to install — it all runs right here in your browser.

1

Select fonts and weights

Search for fonts and check the weights you need. Only select weights you actually use in your CSS - each adds download size.

2

Preview the combination

Type sample text to see how the selected fonts and weights render together. Verify readability at both heading and body sizes.

3

Copy the embed code

Click Copy to get the optimized link tags with preconnect and display=swap. Paste into your HTML head before your main stylesheet.

The output

What the generated code looks like

Clean, production-ready CSS — no vendor bloat, no unnecessary declarations.

index.html
<!-- In <head>, before your stylesheet -->
<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;600;700&family=Playfair+Display:wght@700&display=swap" rel="stylesheet">

The two preconnect links warm up the connection to Google Fonts servers before the browser encounters the stylesheet request, reducing load latency.

Pro tips

Pro tips for better results

Always add display=swap

Without display=swap, text is invisible until the font loads. With swap, the browser shows a fallback font immediately and swaps in the web font when ready, preventing blank text during load.

The preconnect links reduce font load time

Adding rel="preconnect" for fonts.googleapis.com and fonts.gstatic.com tells the browser to open the connection early. This can save 100-300ms on first font request.

Consider self-hosting for best performance

Download fonts from fonts.google.com and host them yourself. This eliminates external DNS lookups and the Google Fonts CDN round-trip. WOFF2 is the format to use - it is supported everywhere and is the smallest.

Use the Google Fonts API subset parameter for Latin-only sites

Adding &subset=latin to your URL can reduce font file size if your content only uses Latin characters. The default includes many extended character sets.

FAQ

Frequently asked questions

Yes - it adds 1-3 network requests and some latency. With preconnect and display=swap, the impact is minimal for most sites. For best performance, self-host the WOFF2 files and serve them from your own CDN.
When a user loads your page, their browser makes a request to fonts.googleapis.com, which logs the request IP. If this is a concern, self-host the font files instead. The CSS Pixels generator helps you build the URL; hosting is your choice.
No. The font URL generation runs in your browser. Nothing is sent to any server.

From the blog

Read more