I have installed EmacsW32. I need to edit my .emacs file.

Where is the .emacs file located on Windows?

  • Where have you looked for an answer to this question? What have you tried to do to solve your problem before asking here? – Stefan Mar 26 '18 at 2:17

I don't actually know, since (being a relative newcomer to Emacs and thus not having done any customization) I don't have a .emacs for my (WinXP) desktop, but I do have a directory, %USERPROFILE%\Application Data\.emacs.d I'd put it there and see if it works.

  • Whee, a sane Windows port of a *nix program. Most don't bother using the correct paths and simply litter the user's profile with .something folders or files. – Joey May 5 '10 at 22:05

From the GNU Emacs FAQ for MS Windows:

3.5 Where do I put my init file?

On Windows, the .emacs file may be called _emacs for backward compatibility with DOS and FAT filesystems where filenames could not start with a dot. Some users prefer to continue using such a name, because Explorer cannot create a file with a name starting with a dot, even though the filesystem and most other programs can handle it. In Emacs 22 and later, the init file may also be called .emacs.d/init.el. Many of the other files that are created by lisp packages are now stored in the .emacs.d directory too, so this keeps all your Emacs related files in one place.

All the files mentioned above should go in your HOME directory. The HOME directory is determined by following the steps below:

  1. If the environment variable HOME is set, use the directory it indicates.
  2. If the registry entry HKCU\SOFTWARE\GNU\Emacs\HOME is set, use the directory it indicates.
  3. If the registry entry HKLM\SOFTWARE\GNU\Emacs\HOME is set, use the directory it indicates. Not recommended, as it results in users sharing the same HOME directory.
  4. If C:.emacs exists, then use C:/. This is for backward compatibility, as previous versions defaulted to C:/ if HOME was not set.
  5. Use the user's AppData directory, usually a directory called Application Data under the user's profile directory, the location of which varies according to Windows version and whether the computer is part of a domain.

Within Emacs, <~> at the beginning of a file name is expanded to your HOME directory, so you can always find your .emacs file with C-x C-f ~/.emacs.


In my Swedish version of Windows 7 Professional, .emacs and/or .emacs.d/ are placed in C:\Users\username\AppData\Roaming


For Windows 10, find the place of the init file or GNU Emacs 25' the place of the .emacs file or .emacs.d folder is in the c:/Users/username/AppData/Roaming.

Or some sources will write it as %HOMEPATH%\AppData\Roaming\.emacs, in which that homepath is c:/users/yourusernamehere in my opinion.

So, let's assume that you don't know how to get there. Open GNU Emacs and enter Ctrl-x Ctrl-f which means find, and then write the tilde ~ and then press Enter that will lead you to the folder where is .emacs file or .emacs.d folder or init file is located.


Edit: GNU Emacs is looking for these three files, so be careful when naming them, because Emacs will look for these three files: .emacs in home folder, .emacs.el in home folder or init.el in .emacs.d folder.
Here is the official GNU Emacs Manual excerpt:

When Emacs is started, it normally tries to load a Lisp program from an initialization file, or init file for short. This file, if it exists, specifies how to initialize Emacs for you. Emacs looks for your init file using the filenames ~/.emacs, ~/.emacs.el, or ~/.emacs.d/init.el; you can choose to use any one of these three names (see Find Init). Here, ~/ stands for your home directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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