A CFG file stores settings that a program reads when it starts
A CFG file is a plain-text document that holds configuration data — the choices and preferences that tell a program how to behave. When you launch an application, it often looks for a CFG file in a specific folder, reads the settings inside, and applies them. CFG stands for "configuration," and the file format has been used for decades across Windows, Mac, and Linux systems.
The file itself contains lines of text, usually in a simple format like setting_name=value or setting_name: value. A program might store your preferred language, window size, audio volume, or network address in a CFG file. If you delete or corrupt the file, the program typically either stops working or resets to factory defaults the next time you open it.
CFG files are different from the settings you change inside a program's menu. When you click "Preferences" in an application and adjust something, that change often gets written to a CFG file behind the scenes. You can also edit a CFG file directly with a text editor if you know what you are doing, though most people never need to.
Key Takeaways
- A CFG file is a text document that stores program settings and preferences, which the program reads when it starts.
- CFG files are usually hidden or stored in a program's installation folder or in your user profile directory.
- You can open and edit a CFG file with any text editor like Notepad, but changing the wrong setting can break the program.
- If a CFG file is missing or damaged, the program will usually reset to default settings or fail to start.
- Different programs use different formats and naming conventions for CFG files, so there is no single standard structure.
Where CFG files are stored on your computer
The location of a CFG file depends on the program that created it. On Windows, many applications store their CFG files in the program's installation folder — often C:\Program Files\ProgramName or C:\Program Files (x86)\ProgramName. Some programs also place CFG files in hidden folders within your user profile, such as C:\Users\YourUsername\AppData\Local or C:\Users\YourUsername\AppData\Roaming.
On Mac, CFG files are typically stored in ~/Library/Application Support/ProgramName or inside the application bundle itself. On Linux, they often live in ~/.config or /etc depending on whether they are user-specific or system-wide settings.
To find a CFG file, you can search your computer by filename if you know what it is called. In Windows, use the File Explorer search box and type the filename. On Mac or Linux, open Terminal and use the find command. If the file is hidden, you may need to enable "Show hidden files" in your file manager first.
How to open and edit a CFG file
You can open any CFG file with a plain-text editor. On Windows, right-click the CFG file, select "Open with," and choose Notepad or another text editor. On Mac, right-click and select "Open With," then pick TextEdit (set to plain-text mode) or another editor. On Linux, use a terminal editor like nano or vi, or a graphical editor like gedit.
Before you edit a CFG file, make a backup copy first. Right-click the file, select "Copy," and paste it in the same folder with a name like config_backup.cfg. That way, if something goes wrong, you can restore the original.
When you open the file, you will see lines of text with settings and values. Each line usually follows a pattern like resolution=1920x1080 or volume=80. Change only the value part, not the setting name, and keep the format exactly as it was. Save the file when you are done, and the program will read the new settings the next time it starts.
What happens if a CFG file is missing or corrupted
If a program cannot find its CFG file when it starts, one of two things usually happens. The program may create a new CFG file with default settings, resetting all your preferences. Alternatively, the program may refuse to start and display an error message.
If the CFG file exists but is corrupted — for example, if you accidentally deleted a line or introduced a typo — the program may ignore the broken setting and use a default value instead, or it may fail to read the entire file and reset everything. Some programs are more forgiving than others.
To fix a corrupted CFG file, you can delete it and let the program recreate it with defaults, then reconfigure your preferences through the program's menu. Alternatively, if you have a backup, you can restore the backup copy and try again.
CFG files versus other configuration file types
CFG is one of several file extensions used for configuration. You might also see .INI files (common on older Windows programs), .CONF files (typical on Linux), .XML files (used by modern applications), or .JSON files (increasingly popular). All of them serve the same purpose: storing settings in a format the program can read.
The difference is mainly in structure and readability. A CFG or INI file is usually simple key-value pairs, easy to edit by hand. An XML or JSON file has more complex formatting but can store more detailed information. A program's documentation will tell you which format it uses and where to find the file.
Some programs do not use separate configuration files at all. Instead, they store settings in the Windows Registry (on Windows), in a database, or in the cloud. These programs do not have a CFG file you can edit directly.
When you might need to edit a CFG file manually
Most of the time, you change program settings through the application's menu, and the CFG file updates automatically. However, there are situations where editing the CFG file directly is useful or necessary.
If a program crashes before you can access its menu, you might edit the CFG file to change a problematic setting. If you are moving a program to a new computer and want to transfer your settings, you can copy the CFG file to the new installation. If you are troubleshooting a problem and a support technician asks you to change a specific setting, they might direct you to edit the CFG file instead of navigating menus.
Some advanced users also edit CFG files to access settings that are not exposed in the program's graphical menu. Game mods and server configurations often require CFG file edits. However, if you are not sure what a setting does, do not change it — an incorrect value can break the program or cause unexpected behavior.
How to back up and restore CFG files
Backing up your CFG files protects your settings in case something goes wrong. To back up, navigate to the folder where your CFG files are stored, select them, right-click, and choose "Copy." Paste them into a backup folder on an external drive or cloud storage. You can also use backup software that automatically copies important files.
If you need to restore a CFG file, simply copy the backup back to the original location. If the program is running, close it first. Then paste the backup file, replacing the current one if prompted. The next time you open the program, it will read the restored settings.
For programs you use frequently, consider backing up the entire folder containing the CFG file, not just the configuration file itself. This ensures you have all related data if you ever need to restore.
Frequently Asked Questions
Can I move a CFG file from one computer to another?
Yes, if the program is the same version on both computers. Copy the CFG file to the same location on the new computer, and the program will read your settings. However, some settings may be computer-specific — like file paths or hardware preferences — so you might need to adjust those manually after moving the file.
What should I do if I accidentally delete a CFG file?
Close the program immediately. If you have a backup, restore it. If not, delete the corrupted or incomplete CFG file and restart the program — it will create a new one with default settings. You can then reconfigure your preferences through the program's menu.
Is it safe to edit a CFG file?
It is safe if you know what you are changing. Always make a backup first. Change only the value, not the setting name, and keep the format exactly as it was. If you are unsure what a setting does, leave it alone or consult the program's documentation.
Why does my program keep resetting my settings?
The program may not have permission to write to the CFG file, or the file may be corrupted and recreating itself each time. Check that the file is not read-only by right-clicking it, selecting Properties, and unchecking "Read-only." If that does not work, try deleting the CFG file and letting the program create a new one.
Do I need to edit CFG files to use a program normally?
No. Most people never edit a CFG file directly. You change settings through the program's menu, and the CFG file updates automatically. You only need to edit a CFG file if you are troubleshooting, transferring settings, or accessing advanced options not available in the menu.