Do .elc files take precedence over .el files when using load?

Say I have two files in my load path: foo.el and foo.elc. If I call (load "foo"), will the byte-compiled version (foo.elc) always be loaded instead of the uncompiled foo.el?

  • Yes. See the Emacs manual, node Lisp Libraries. (Ask Emacs.)
    – Drew
    Commented Feb 24, 2017 at 16:34
  • See also load-prefer-newer, which can customize this behavior.
    – glucas
    Commented Feb 24, 2017 at 18:23

2 Answers 2


By default the .elc would be loaded rather than the .el, as noted in the other answers/comments.

A few things can affect this behavior, however:

  • Set load-prefer-newer to t if you want to load whichever file is newer. In that case the .el will be loaded if it has been modified more recently than the corresponding .elc file.

  • See the variable load-suffixes, which defines the suffixes that load will try, in order of preference.


Yes, .elc files take precedence over .el files, even if they both exist in your load path.

According to emacswiki.org:

When both a byte-compiled file (.elc) and a source file (.el) are found for the same library, preference is given to byte-compiled file.

  • 2
    The wiki is generally (and in this case) a good source. But Emacs is typically a better source, when it covers the same information.
    – Drew
    Commented Feb 24, 2017 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.