What is the CONFIG file format?
.config files are commonly used within a system as configuration files. Using configuration files, various options, parameters and preferences within specific applications or the whole system are defined. In most .config files, all properties are stored as plain text - most often as XML, which is the format Microsoft .NET uses for App.config (desktop applications) and Web.config (ASP.NET web projects). Some programs instead use an INI-style key=value format or YAML.
Computer software and operating systems often rely on many settings and parameters necessary for controlling ongoing processes. .config files serve this purpose - among other things, they specify file directories, connection strings, and application behaviour switches. In some programs, more than one such file may be used, but this is usually seen in more complex applications.
- Since these are text-based files, they can be edited with any plain-text editor, including Notepad on Windows. Before editing, you should familiarise yourself with the file's content, as incorrect changes can negatively affect the functioning of programs or the operating system.
.configfiles define how a program initialises or operates at runtime - most applications read them during startup. In .NET, a project'sApp.configis copied and renamed to<AssemblyName>.exe.configin the output folder.- The .NET runtime also reads a machine-wide
machine.configand merges its settings with the application configuration; app-level settings take precedence over machine defaults. Related formats include .cfg files used by many non-.NET applications.
Security & safety
RISK: MEDIUMA text .config is safe to open and read. The risk is in EDITING: because a .config often controls whether its program starts (and, for .NET, how it connects to databases), a bad value, typo or broken XML tag can stop the application working. Always copy the original to a backup before changing anything, edit with a plain- text/code editor (never a word processor), and change one thing at a time. Also note that .config files can hold sensitive data (database connection strings, passwords, API keys in Web.config) - treat them as confidential, and be wary of downloaded 'optimized' config files from untrusted sources.
Format details
in a nutshellPrograms that open CONFIG files
Technical details
deep spec| Primary format | XML - a `<configuration>` root element wrapping `<appSettings>`, `<connectionStrings>`, and `<system.*>` sections in the standard .NET layout |
| File encoding | UTF-8 (standard for .NET XML config files; encoding declared in the XML prolog) |
| MIME type | `text/xml` |
| File signature | None universal; the .NET XML variant starts with `<?xml ...?>` at offset 0; INI-style key=value variants have no magic bytes |
| Root element (.NET) | `<configuration>` - required outermost element; children such as `<appSettings>` and `<connectionStrings>` follow a schema enforced by the runtime |
| Runtime read mechanism | Read at application startup by the .NET `ConfigurationManager` (or `IConfiguration` in .NET Core / .NET 5+); changes require an app restart unless a configuration reload is explicitly configured |
| Machine-level defaults | `machine.config` in the .NET Framework installation folder provides system-wide defaults; application `.config` settings always override machine defaults |
| Build-time transformation | XML Document Transform (`.xdt`) files such as `App.Debug.config` and `App.Release.config` are merged by MSBuild to produce environment-specific output files |
| Deployed file name | For .NET desktop apps the output is renamed to `<AssemblyName>.exe.config`; for ASP.NET the file stays as `Web.config` in the web root |
| Connection strings section | `<connectionStrings>` child element stores named database connection strings; the `providerName` attribute specifies the ADO.NET provider (e.g. `System.Data.SqlClient`) |
| Alternate text formats | Some applications use `.config` for INI-style `key=value` text, YAML, or TOML instead of XML - the internal format is entirely application-defined |
| Security handling | IIS blocks direct HTTP access to `.config` files by default; sensitive values such as passwords can be encrypted in place using `aspnet_regiis -pe` on Windows |
| Line endings | Typically CRLF on Windows, LF on Linux/macOS; the XML parser normalises both |
| Related extensions | `.cfg`, `.ini`, `.conf`, `.xml`, `.json`, `.yaml` |
| Released | No single origin; .NET App.config/Web.config since .NET Framework 1.0 (2002) |
| Specification | learn.microsoft.com |
CONFIG conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about CONFIG files.