A CFG file stores settings that tell a program how to behave
A CFG file is a plain-text document that holds configuration settings — the choices that control how a program runs. When you change a setting in a program's preferences menu, that change usually gets saved to a CFG file. The next time you open the program, it reads that file and remembers your choices.
CFG stands for "configuration," and these files are one of the oldest ways computers store preferences. They are straightforward: just text you can read and edit, organized in a way the program understands. A game might store your graphics quality and control layout in a CFG file. A server process might store the port number it listens on. A media player might remember your volume level and the last folder you opened.
The key difference between a CFG file and other settings storage is that CFG files are meant to be human-readable and often editable by hand. You can open one in Notepad and change values directly if you know what you are doing — though most people never need to.
Key Takeaways
- CFG files store program settings as plain text, so the program can read them each time it starts and remember your preferences.
- You can usually edit CFG files in Notepad or any text editor, but changing the wrong value can break how a program works.
- Different programs use different formats for their CFG files, so a CFG file from one program will not work in another.
- Deleting a CFG file resets a program to its default settings, which is sometimes the fastest way to fix a broken configuration.
Where CFG files live on your computer
CFG files are usually hidden in the same folder as the program that uses them, or in a settings folder inside your user account. On Windows, program settings often live in AppData, a folder that is hidden by default. On Mac, they are usually in a folder called .config or Library inside your home directory. On Linux, they are typically in /etc or in a hidden folder in your home directory.
You do not normally need to find these files yourself. When you change a setting in a program's menu, the program writes the change to its CFG file automatically. But if you are troubleshooting a broken program or trying to move settings from one computer to another, knowing where to look helps.
Some programs let you export or import settings from a menu, which is safer than editing the CFG file by hand. If that option exists, use it. If you do need to edit a CFG file directly, make a backup copy first — that way you can restore the original if something goes wrong.
How to read and edit a CFG file safely
Open a CFG file in Notepad, TextEdit, or any plain-text editor — not Word or Google Docs, which add formatting that will break the file. On Windows, right-click the CFG file, choose "Open with," and select Notepad. On Mac, use TextEdit but make sure to go to Format menu and choose "Make Plain Text" first.
Inside the file you will see lines like volume=80 or resolution=1920x1080 or fullscreen=true. Each line is a setting. You can change the value after the equals sign. If you change volume=80 to volume=50, the program will start at half volume next time. If you set fullscreen=true to fullscreen=false, the program will open in a window instead.
The danger is changing a setting to something the program does not understand. If you set volume=banana, the program might crash or ignore that line. If you are not sure what a setting does, leave it alone. Many CFG files include comments — lines starting with # or ; — that explain what each setting means.
After you edit and save the file, close the program completely and reopen it. The program will read the updated CFG file and explore your changes.
CFG files versus other settings storage methods
Older programs and servers use CFG files because they are straightforward and work the same way on Windows, Mac, and Linux. Newer programs often store settings in other formats: JSON files (which are structured like nested lists), XML files (which use tags like HTML), or in a database. Games sometimes use INI files, which look similar to CFG files but use a slightly different format with sections marked by brackets.
The advantage of CFG files is that they are fast to read and write, and they work on any system. The disadvantage is that they do not handle complex data well — if a program needs to store a list of 500 items, a CFG file becomes hard to manage. That is why modern applications often switched to JSON or databases.
You might also encounter CONF files, which are essentially the same thing as CFG files — just a different extension. Some Linux programs use CONF instead of CFG, but they work identically.
What to do if a CFG file gets corrupted
If a program starts crashing or behaving strangely, a corrupted CFG file is often the culprit. The fastest fix is to delete the CFG file and let the program recreate it with default settings. Close the program, find its CFG file, and delete it. When you reopen the program, it will generate a fresh CFG file with all settings reset to factory defaults.
This will erase your preferences — your volume level, window size, saved paths, and any other customizations — but it usually fixes the problem. You can then reconfigure the settings from the preferences menu. If the program still crashes after you delete the CFG file, the problem is something else.
If you want to keep some settings, you can try opening the CFG file in a text editor and looking for obviously broken lines. Sometimes a setting gets saved with a value that is too long or contains a character the program does not expect. Removing that line and saving the file might fix it without losing everything.
Why programs use CFG files instead of asking you each time
Without a CFG file, every time you opened a program it would start fresh with no memory of your choices. You would have to set your volume, window size, and preferences all over again. CFG files let the program remember what you wanted last time and start the same way.
For servers and background applications, CFG files are even more important. A web server needs to know which port to listen on, which files to serve, and how to handle requests. That information lives in a CFG file so the server can start automatically without anyone typing commands.
CFG files also make it possible to move a program's settings from one computer to another. You can copy the CFG file to a new machine, and the program will behave exactly the same way. This is why system administrators often back up CFG files — they contain the entire configuration of a system.
Frequently Asked Questions
Can I delete a CFG file without breaking anything?
Yes. Deleting a CFG file resets the program to its default settings, but it does not damage the program itself. The program will create a new CFG file with default values the next time it starts. You will lose your preferences, but the program will still work.
What if I edit a CFG file and the program stops working?
Close the program, restore the CFG file from your backup copy, and try again. If you did not make a backup, delete the CFG file entirely and let the program recreate it. Then reconfigure your settings through the preferences menu instead of editing the file by hand.
Can I copy a CFG file from one computer to another?
Usually yes, as long as both computers have the same version of the program installed. Copy the CFG file to the same location on the new computer, and the program will use those settings. This does not always work if the two computers have different operating systems or very different hardware.
Why is my CFG file hidden?
Operating systems hide configuration files by default to prevent accidental deletion or editing. On Windows, enable "Show hidden files" in View options. On Mac, press Command+Shift+Period in Finder. On Linux, use the command ls -a to list hidden files in the terminal.
Is it safe to edit a CFG file while the program is running?
No. If the program is open, it may overwrite your changes when it closes, or it may read a partially edited file and crash. Always close the program completely before editing its CFG file, then reopen it to explore the changes.