Customizing Fonts in Firefox
This guide will walk you through how to change the fonts used in different parts of the Firefox browser.
Prerequisites
- You need to have Mozilla Firefox installed on your computer.
- Familiarity with basic file system navigation (creating folders and files).
Changing the Developer Tools Font
This will change the font used within Firefox’s Developer Tools.
-
Open Troubleshooting Information: Open Firefox and press the Alt key to show the top menu. Click on
Help$\rightarrow$Troubleshooting Information.
-
Open Profile Folder: On the
Troubleshooting Informationpage, locate theProfile Folderentry and click theOpen Folderbutton beside it. This will open your Firefox profile directory in your operating system’s file explorer.
-
Create the
chromeFolder: In the profile directory that opens, create a new folder namedchrome(all lowercase).
-
Create
userContent.css: Inside the newly createdchromefolder, create a new text file and save it with the nameuserContent.css. You might see a warning about changing the file extension; confirm that you want to do this. More info onuserContent.css -
Add CSS for Dev Tools: Open the
userContent.cssfile with a text editor and copy the following CSS code into it:@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono&display=swap"); @-moz-document regexp("chrome://browser/content/devtools/**/.*") { .devtools-monospace { font-family: "JetBrains Mono", monospace !important; font-size: 8pt !important; } }@import url(...): This line imports the JetBrains Mono font from Google Fonts.@-moz-document regexp(...): This tells Firefox to apply the styles within this block only to pages whose URL matches the given regular expression, which in this case targets the Firefox Developer Tools..devtools-monospace: This selector targets the elements within the Dev Tools that use a monospace font.font-family: This sets the font to “JetBrains Mono”, and falls back to a genericmonospacefont if JetBrains Mono isn’t available.font-size: This sets the font size to 8 points. Feel free to adjust this value.
-
Enable User Profile Customizations: Open a new tab in Firefox, type
about:configin the address bar, and press Enter. You might see a warning; click “Accept the Risk and Continue”. In the search bar, typetoolkit.legacyUserProfileCustomizations.stylesheetsand set this preference totrueby clicking the toggle button.
-
Restart Firefox: Close and restart Firefox for the changes to take effect.
Customizing Code Block Fonts on Web Pages
This will change the font used in <code> elements on websites you visit.
-
Edit
userContent.css: Open thechrome/userContent.cssfile you created earlier. -
Add CSS for Code Blocks: Add the following CSS code to the end of the file:
code { font-family: "JetBrains Mono", monospace !important; } -
Restart Firefox: Save the
userContent.cssfile and restart Firefox.
Modifying the Global UI Font
This will change the font used for the entire Firefox browser interface (menus, tabs, etc.).
-
Create
userChrome.css: Inside thechromefolder, create a new text file and save it asuserChrome.css. -
Add CSS for Global UI: Open the
userChrome.cssfile with a text editor and copy the following CSS code into it:@import url("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap"); * { font-family: "Inter" !important; } -
Enable User Profile Customizations (if you haven’t already): Go to
about:configand ensure thattoolkit.legacyUserProfileCustomizations.stylesheetsis set totrue. -
Restart Firefox: Save the
userChrome.cssfile and restart Firefox.
Reverting to Default Fonts
To go back to the default fonts, you can either:
- Delete the
chromefolder inside your profile directory. - Remove the CSS code you added from the
userContent.cssanduserChrome.cssfiles.
Finding Other Fonts
You can explore other fonts on websites like Google Fonts. To use a different web font, replace the @import url(...) line with the one provided by Google Fonts for your chosen font. For locally installed fonts, you can directly use their name in the font-family property (e.g., font-family: "Your Local Font Name", sans-serif !important;).