Skip to main content
Configuration files allow you to set default options for yt-dlp without having to specify them on the command line every time. yt-dlp loads configuration from multiple locations in a specific order.

Configuration File Locations

yt-dlp searches for configuration files in the following locations (in order of priority):

1. Main Configuration

The file specified with --config-locations:

2. Portable Configuration

Recommended for portable installations If using a binary:
  • yt-dlp.conf in the same directory as the binary
If running from source:
  • yt-dlp.conf in the parent directory of yt_dlp
This is ideal for portable installations where you want the configuration to travel with the executable.

3. Home Configuration

  • yt-dlp.conf in the home path given to -P
  • If -P is not given, the current directory is searched

4. User Configuration

Recommended locations:
  • ${XDG_CONFIG_HOME}/yt-dlp/config
  • ${XDG_CONFIG_HOME}/yt-dlp.conf
  • ${XDG_CONFIG_HOME}/yt-dlp/config.txt
Fallback locations:
  • ~/.yt-dlp/config
  • ~/yt-dlp.conf
  • ~/yt-dlp.conf.txt
  • ~/.yt-dlp/config.txt
${XDG_CONFIG_HOME} defaults to ~/.config if unset

5. System Configuration

Linux/macOS only:
  • /etc/yt-dlp.conf
  • /etc/yt-dlp/config
  • /etc/yt-dlp/config.txt
If --ignore-config is found in the system configuration file, user configuration is not loaded (for backward compatibility).

Configuration File Syntax

Configuration files use the same options as command line switches:

Basic Rules

  1. One option per line
  2. No whitespace after - or --
  3. Comments start with #
  4. Quote values when necessary (as in a shell)

Example Configuration

Configuration File Encoding

Configuration files are decoded according to:
  1. UTF BOM if present
  2. System locale encoding otherwise

Specifying Encoding

To force a specific encoding, add this as the first line:
Examples:
There must be no characters before the encoding declaration, not even spaces or BOM.

Ignoring Configuration Files

Disable configuration file loading:

Partial Ignore

If --ignore-config is found inside a configuration file:
  • No further configuration files are loaded
  • Useful for preventing cascading configs

Exclude Specific Locations

Multiple Configuration Files

Load additional configuration files:

Practical Configuration Examples

Default Quality Settings

Organization and Archiving

Performance and Reliability

Subtitle Preferences

Post-Processing

Per-Site Configuration

While yt-dlp doesn’t have built-in per-site configs, you can use shell aliases:

Environment Variables

Variable Syntax

  • UNIX: ${VARIABLE} or $VARIABLE
  • Windows: %VARIABLE%
  • yt-dlp allows UNIX-style variables on Windows for path options

Common Variables

  • ${HOME} - User home directory
  • ${XDG_CONFIG_HOME} - Config directory (defaults to ~/.config)
  • ${XDG_CACHE_HOME} - Cache directory (defaults to ~/.cache)

Using Variables in Config

Debugging Configuration

See which configuration files are loaded:

Best Practices

Troubleshooting

Config Not Loading

Option Conflicts

Syntax Errors

Common mistakes: