There is a way. It's not super official, but basically you can unpack browser/omni.ja, edit the keybindings in chrome/browser/content/browser/browser.xul, repack it, delete startup cache and it will work.

Alternatively, you can compile your own firefox and then you don't need to unpack the binary, if you consider unpacking and repacking more hacky, than building.

Another advantage of building is that you can store your modifications on top of the official sources in git and always rebase, like I do here: https://github.com/errge/gecko-dev/tree/gregzilla-patched-20181223

I advise you to first start with the binary option, because you will have working keyboard shortcuts in 20 minutes, instead of just being at the start of the mercurial clone procedure :)

Both of these methods are independent of any extensions/webextensions and will ALWAYS work, even in the location bar and even on protected pages (as you asked in the comments). So they will work better than remapping webextensions.

I have an article written up with all the details that may interest you: https://github.com/nilcons/firefox-hacks

If you have more questions, please report issues on github.

Answer from errge on Stack Exchange
🌐
Mozilla Support
support.mozilla.org › en-US › kb › customize-keyboard-shortcuts-firefox
Customize keyboard shortcuts in Firefox | Firefox Help
January 15, 2026 - Replace hard-to-type or hard-to-remember hotkeys, eliminate conflicts with other software, and create your preferred set to optimize workflows. Type about:keyboard in the Firefox address bar and press Enter. Find the hotkey you want to change by using the Search field at the top of the page, ...
Discussions

How to change Firefox keyboard shortcuts
Hi board! Can anybody tell me how to configure the Keyboard shortcuts of Firefox? I know that there is an extension called keyconfig and I used it with Firefox 1.0 but I it wasn't updated since 2005 or something. I also had a closer look at about:config but didn't find anything. More on community.unix.com
🌐 community.unix.com
0
0
February 13, 2008
Change default keyboard shortcuts (on Firefox) - Zotero Forums
Actually the keyboard shortcut CTRL+MAJ+S on Firefox activate the developer tools (console, inspector, etc.), very useful. More on forums.zotero.org
🌐 forums.zotero.org
Override Keyboard Shortcuts in Firefox - Stack Overflow
How do I override Keyboard Shortcuts in Firefox so that it can be picked up by web page For example, I have a webpage that detects ctrl-shift-h which worked fine in version 56 but now in version 96... More on stackoverflow.com
🌐 stackoverflow.com
How to change a keyboard shortcut in Firefox? - Hardware and technical stuff - Quarter To Three Forums
Two questions: What is the keyboard shortcut for open tab in new window? It’s frustrating that the settings window does not have a list of keyboard shortcuts in Firefox. Once I know what the keyboard shortcut for this is, how do I change it to something I won’t accidentally hit? ... More on forum.quartertothree.com
🌐 forum.quartertothree.com
0
December 7, 2025
🌐
Power Users
powerusers.codidact.com › posts › 292147
Change keyboard shortcuts in Firefox - Power Users
Currently, there doesn't appear to be a user-friendly way to change the keyboard shortcuts on Firefox without extensions, regardless of OS.
🌐
Mozilla Support
support.mozilla.org › mk › questions › 1381773
Why can't we customize the keyboard shortcuts? | Firefox ...
July 3, 2022 - JavaScript is disabled in your browser · Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser
Top answer
1 of 10
20

There is a way. It's not super official, but basically you can unpack browser/omni.ja, edit the keybindings in chrome/browser/content/browser/browser.xul, repack it, delete startup cache and it will work.

Alternatively, you can compile your own firefox and then you don't need to unpack the binary, if you consider unpacking and repacking more hacky, than building.

Another advantage of building is that you can store your modifications on top of the official sources in git and always rebase, like I do here: https://github.com/errge/gecko-dev/tree/gregzilla-patched-20181223

I advise you to first start with the binary option, because you will have working keyboard shortcuts in 20 minutes, instead of just being at the start of the mercurial clone procedure :)

Both of these methods are independent of any extensions/webextensions and will ALWAYS work, even in the location bar and even on protected pages (as you asked in the comments). So they will work better than remapping webextensions.

I have an article written up with all the details that may interest you: https://github.com/nilcons/firefox-hacks

If you have more questions, please report issues on github.

2 of 10
18

You can change key bindings in Firefox with AutoConfig, without having to unpack and modify the Firefox binary.

Create a config-prefs.js and config.js file:

on Windows:

  • C:\Program Files\Mozilla Firefox\defaults\pref\config-prefs.js
  • C:\Program Files\Mozilla Firefox\defaults\pref\config.js

on macOS:

  • Firefox.app\Contents\Resources\config.js
  • Firefox.app\Contents\Resources\defaults\pref\config-prefs.js

on Linux:

  • /usr/lib/firefox/config.js (resp /usr/lib64/firefox/config.js)
  • /usr/lib/firefox/browser/defaults/preferences/config-prefs.js (resp /usr/lib64/firefox/browser/defaults/preferences/config-prefs.js)

If the above path is not correct, use whereis firefox to find the correct directory on your system.

with the following content:

config-prefs.js:

pref("general.config.filename", "config.js");    
pref("general.config.obscure_value", 0);  
pref("general.config.sandbox_enabled", false);  

config.js:

try {                                                                                                                                                                                                                                                                                               
  let { classes: Cc, interfaces: Ci, manager: Cm  } = Components;
  const Services = globalThis.Services;                                                                                                                                                                                                                                                             
  // Firefox 148+: use browser-delayed-startup-finished instead of
  // chrome-document-global-created (Bug 2002767 changed startup sequence)
  function ConfigJS() { Services.obs.addObserver(this, 'browser-delayed-startup-finished', false); }
  ConfigJS.prototype = {
    observe: function (window) {

          // Place your keyboard shortcut changes here
          // ...
          // ...

    }
  };
  if (!Services.appinfo.inSafeMode) { new ConfigJS(); }
} catch(ex) {};

After modifying these files, you always have to go to about:support and run Clear startup cache, to restart the browser with the new config.

Some examples what you can do:

Put these snippets into config.js, where I wrote Place your keyboard shortcut changes here.

Remove an existing keyboard shortcut

// remove Ctrl-Shift-X, so that I can map it to 1Password in the 1Password app later
let keySwitchDirection = window.document.getElementById('key_switchTextDirection');
keySwitchDirection.remove();

Change an existing keyboard shortcut

// remap Ctrl-J to downloads (removing it from focusing the browser bar)
let search2 = window.document.getElementById('key_search2')
search2.remove();
let openDownloads = window.document.getElementById('key_openDownloads')
openDownloads.setAttribute("modifiers", "accel");
openDownloads.setAttribute("key", "J");

Create a new keyboard shortcut

// create keyboard shortcut to Toolbar > Settings with Ctrl-,
let mainKeyset = window.document.getElementById("mainKeyset");
let settingsKey = window.document.createElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'key');
settingsKey.setAttribute("id", "key_Settings");
settingsKey.setAttribute("modifiers", "accel,shift");
settingsKey.setAttribute("key", "U");
settingsKey.setAttribute("oncommand", "openPreferences()");
settingsKey.addEventListener('command', this, false);
mainKeyset.appendChild(settingsKey);

Something completely custom. (Firefox introduced the Shift-Ctrl-T as an universal undo (change set), so the example here is not necessary anymore. I'll leave it here to serve as an example for other customizations.)

// make Ctrl-Shift-T reopen last tab OR last window, depending on which one was closed last
let undoCloseTabKey = window.document.getElementById('key_undoCloseTab');
undoCloseTabKey.removeAttribute('command');
undoCloseTabKey.setAttribute('oncommand', 'undoCloseLastClosedTabOrWindow()');
undoCloseTabKey.addEventListener('command', this, false);

window.undoCloseLastClosedTabOrWindow = function() {
  // don't have any tabs to restore
  if (SessionStore.getClosedTabCount(window) == 0) {
    // we don't need to worry whether there are any windows to restore - undoCloseWindow does that for us
    window.undoCloseWindow();
  }

  // don't have any windows to restore
  else if (SessionStore.getClosedWindowCount() == 0) {
    // we don't need to worry whether there are any tabs to restore - undoCloseTab does that for us
    window.undoCloseTab();
  }

  // restore whichever was closed more recently
  else if (SessionStore.getClosedTabData(window)[0].closedAt > SessionStore.getClosedWindowData()[0].closedAt) {
    window.undoCloseTab();
  } else {
    window.undoCloseWindow();
  }
}

Instructions:

To find existing keyboard shortcuts:

  • Hamburger menu > More Tools > Browser Toolbox
  • In the Inspector, search for #mainKeyset
  • There, you see all assigned keyboard shortcuts

To find menu actions that you can trigger with keyboard shortcuts

  • Hamburger menu > More Tools > Browser Toolbox
  • Use the Inspector to find the element that you want to trigger with a keyboard shortcut, for example appMenu-settings-button
  • Take the oncommand attribute from the menu item, and use it as oncommand attribute for the key tag

or

  • Use the Inspector, search for #mainCommandSet
  • and take the commands's id, and use it as command (not oncommand) attribute for the key tag.

Defining keyboard shortcuts:

  • specify modifiers with the modifiers attribute. You can use accel (for Ctrl), shift and alt
  • specify the key itself with the key attribute

Source for all of this: Reddit, u/aveyo, Restore Ctrl+Shift+B = Library by setting config.js

More details: Firefox Keyboard Shortcuts (Web Archive)

🌐
YouTube
youtube.com › chief tuts
How To Change Keyboard Shortcuts on Firefox (Easiest Way)​​​​​​
In this video I will show you How To Change Keyboard Shortcuts on Firefox. It would be good if you watch the video until the end so that you don't miss impor...
Published   December 23, 2024
Views   49
Find elsewhere
🌐
MrFdev
mrfdev.com › youtube-keyboard-shortcuts
Keyboard shortcuts for YouTube™
Note: You can give the focus to ... the version 2.0.103 of Enhancer for YouTube™ you can configure a keyboard shortcut to give the focus to the video player. See the Manage extension shortcuts in Firefox, Chrome, Edge page....
🌐
PCWorld
pcworld.com › home › news › software news
Firefox finally gets custom keyboard shortcuts, delighting long-time fans | PCWorld
November 18, 2025 - You can find the new options for changing or clearing these shortcuts by typing about:keyboard in the URL bar in Firefox version 147.
🌐
Mozilla Add-ons
addons.mozilla.org › en-US › firefox › addon › shortkeys
Shortkeys (Custom Keyboard Shortcuts) for Firefox – Get this Extension for 🦊 Firefox (en-US)
September 4, 2017 - Download Shortkeys (Custom Keyboard Shortcuts) for Firefox for Firefox. Create custom keyboard shortcuts for your browser: 125+ built-in actions, macros, shortcut packs, command palette, cloud sync, and more.
🌐
Unix Community
community.unix.com › unix for beginners q & a › unix for dummies questions & answers
How to change Firefox keyboard shortcuts - UNIX for Dummies Questions & Answers - Unix Linux Community
February 13, 2008 - Hi board! Can anybody tell me how to configure the Keyboard shortcuts of Firefox? I know that there is an extension called keyconfig and I used it with Firefox 1.0 but I it wasn’t updated since 2005 or something. I als…
🌐
Windows Report
windowsreport.com › news › firefox finally lets you customize keyboard shortcuts, 25 years after the first request
Firefox finally lets you customize Keyboard Shortcuts, 25 years after the first request
November 17, 2025 - To set a new shortcut, visit about:keyboard page in the address bar and click “Change”, then press the new key combination you want. You can remove a shortcut with the “Clear” button.
🌐
GeeksforGeeks
geeksforgeeks.org › techtips › keyboard-shortcuts-for-firefox
Keyboard Shortcuts for Firefox - GeeksforGeeks
July 23, 2025 - Here, we are going to enlist Different Firefox Browser Keyboard Shortcuts one by one.
🌐
Mozilla Support
support.mozilla.org › en-US › questions › 1287036
How can I customise/remove a default keyboard shortcut? | Firefox Support Forum | Mozilla Support
Maybe you'd like to give this extension a try :<BR> https://addons.mozilla.org/en-US/firefox/addon/shortkeys/<BR> Also see : <BR> https://www.guidingtech.com/customize-keyboard-shortcuts-firefox/ ... Thanks a lot y'all! Have a nice day. Thanks a lot y'all! Have a nice day. ... I also think that it is not conviniant to not have possobility to change shortcuts.
🌐
Zotero Forums
forums.zotero.org › discussion › 68675 › change-default-keyboard-shortcuts-on-firefox
Change default keyboard shortcuts (on Firefox) - Zotero Forums
Actually the keyboard shortcut CTRL+MAJ+S on Firefox activate the developer tools (console, inspector, etc.), very useful.
🌐
Arch Linux Forums
bbs.archlinux.org › viewtopic.php
Modding firefox shortcuts [solved] / Applications & Desktop Environments / Arch Linux Forums
To swap the alt and control keys: Go to about:config and filter on 'ui.key' Change 17 <--> 18 16=shift 17=control 18=alt 224=meta if ui.key.menuAccessKeyFocuses is true then the menuAccessKey by itself will put focus on the menu-bar.
Top answer
1 of 2
9

I found a way by adding two files under the Firefox directory

Firefox64\defaults\pref\config-prefs.js

pref("general.config.filename", "config.js");    
pref("general.config.obscure_value", 0);  
pref("general.config.sandbox_enabled", false); 

Firefox64\config.js

let { classes: Cc, interfaces: Ci, manager: Cm  } = Components;
const {Services} = Components.utils.import('resource://gre/modules/Services.jsm');
function ConfigJS() { Services.obs.addObserver(this, 'chrome-document-global-created', false); }
ConfigJS.prototype = {
 observe: function (aSubject) { aSubject.addEventListener('DOMContentLoaded', this, {once: true}); },
 handleEvent: function (aEvent) {
   let document = aEvent.originalTarget; let window = document.defaultView; let location = window.location;
   if (/^(chrome:(?!\/\/(global\/content\/commonDialog|browser\/content\/webext-panels)\.x?html)|about:(?!blank))/i.test(location.href)) {
     if (window._gBrowser) {
       let keys = ["key_find", "key_findAgain", "key_findPrevious", "key_gotoHistory", "addBookmarkAsKb", "bookmarkAllTabsKb", "showAllHistoryKb", "manBookmarkKb", "viewBookmarksToolbarKb", "key_savePage", "key_search", "key_search2", "focusURLBar", "focusURLBar2", "key_openDownloads", "openFileKb", "key_reload_skip_cache", "key_viewSource", "key_viewInfo", "key_privatebrowsing", "key_quitApplication", "context-bookmarklink"];
       for (var i=0; i < keys.length; i++) {
          let keyCommand = window.document.getElementById(keys[i]);
          if (keyCommand != undefined) { 
             keyCommand.removeAttribute("command"); 
             keyCommand.removeAttribute("key"); 
             keyCommand.removeAttribute("modifiers"); 
             keyCommand.removeAttribute("oncommand"); 
             keyCommand.removeAttribute("data-l10n-id"); 
          }
       }
     }
   }
 }
};
if (!Services.appinfo.inSafeMode) { new ConfigJS(); }

You can get a list of ids for the keys from the source by putting the following URL in your browser

view-source:chrome://browser/content/browser.xhtml

For those on Linux or similar Unix/Unix-like systems, replace Firefox64 with /usr/lib/firefox. Don't be confused with $HOME/.mozilla/firefox

2 of 2
2

Related to zackhalil's answer:

For those on Linux or simillar Unix/Unix-like systems replace Firefox64 for /usr/lib/firefox. Don't be confused with $HOME/.mozilla/firefox

🌐
Quarter To Three
forum.quartertothree.com › hardware and technical stuff
How to change a keyboard shortcut in Firefox? - Hardware and technical stuff - Quarter To Three Forums
December 7, 2025 - Two questions: What is the keyboard shortcut for open tab in new window? It’s frustrating that the settings window does not have a list of keyboard shortcuts in Firefox. Once I know what the keyboard shortcut for this is, how do I change it to something I won’t accidentally hit? ...
🌐
AskVG
askvg.com › tip-how-to-customize-keyboard-shortcuts-in-mozilla-firefox
TIP: How to Customize Keyboard Shortcuts in Mozilla Firefox
January 29, 2026 - Tech tips, latest news, help and how-to guides for Windows, web browsers, software and mobile phones.