YAML to INI Converter
Convert YAML mappings — from a .yaml or .yml file — into classic INI configuration syntax, with top-level mappings becoming [section] headers and their scalar keys written underneath.
Drop your YAML file here
or
Supports .yaml and .yml files, processed entirely on your device
YAML →JSON
Your converted output will appear here.Conversion notes
What to expect
- Top-level scalar keys are written before any section headers.
- Each top-level object becomes its own [section].
- Sections nested more than one level deep are flattened with dotted keys.
Example
site:
name: Aperture Docs
version: 1.4.2
active: true
tags:
- web
- cli
- tools
author:
name: Jane Doe
email: jane@example.com
tags = web, cli, tools
[site]
name = Aperture Docs
version = 1.4.2
active = true
[author]
name = Jane Doe
email = jane@example.com
When an INI file is all you need
INI is one of the oldest configuration formats, and it is still everywhere: Windows applications, PHP's php.ini, Git's .gitconfig, systemd unit files, desktop entries, and Python's configparser. When a tool only understands [sections] and key = value lines, converting your YAML saves you from restructuring everything by hand.
Its simplicity is both its strength and its limit. INI has just one level of grouping, so this converter turns each top-level YAML mapping into a section and flattens anything deeper into dotted key names rather than losing it.
Python's configparser
Produce a file the standard library can read without third-party YAML packages.
PHP and desktop apps
Create php.ini-style or application settings from a documented YAML source.
Systemd and Git style files
Draft section-based files for tools that follow the INI layout.
Minimal-dependency scripts
Ship configuration that shell scripts and small tools can parse trivially.
How YAML maps to INI
These are the exact rules this converter applies. Each result below was generated by the tool itself, so it matches what you will see in the output panel.
Top-level mappings become sections
Each top-level key whose value is a mapping gets its own [section] header.
database:
host: localhost
port: 5432[database]
host = localhost
port = 5432Top-level scalars come first
Keys that are not inside a mapping are written before any section header.
env: staging
logging:
level: infoenv = staging
[logging]
level = infoLists become comma-separated values
INI has no array syntax, so list items are joined onto one line.
server:
names:
- alpha
- beta[server]
names = alpha, betaDeeper nesting is flattened
Mappings below the section level become dotted keys inside that section.
db:
pool:
min: 2
max: 10[db]
pool.min = 2
pool.max = 10A trickier example: root keys, deep nesting and lists
A settings file with a root-level key, a nested connection pool, a list of replicas and a separate logging section.
env: staging
database:
host: db.internal
pool:
min: 2
max: 10
replicas: [r1, r2]
logging:
level: infoenv = staging
[database]
host = db.internal
pool.min = 2
pool.max = 10
replicas = r1, r2
[logging]
level = infoThe root key sits above the first section, the pool settings are flattened into pool.min and pool.max inside [database], and the replicas become a single comma-separated line. The conversion notes list each of those simplifications.
- Sections deeper than one level were flattened using dotted keys.
- Lists were written as comma-separated values on a single line.
Reading the INI file in Python
configparser needs every key to live inside a section. If your YAML had root-level keys, move them under a section first, or use Python 3.13's allow_unnamed_section option:
import configparser
cfg = configparser.ConfigParser()
cfg.read("settings.ini", encoding="utf-8")
print(cfg["database"]["host"])
print(cfg.getint("database", "pool.max"))YAML vs INI at a glance
INI keeps things deliberately small.
| Feature | YAML | INI |
|---|---|---|
| Nesting | Unlimited depth | One level of sections |
| Lists | Native sequences | Not supported; comma-joined text |
| Types | Numbers, booleans, null | Everything is a string |
| Standardisation | Formal specification | Many dialects, no single standard |
| Typical use | Modern infrastructure | Desktop apps, PHP, Python scripts |
Things to watch for when converting to INI
- INI has no formal standard, so check how the consuming program treats comments, quotes and duplicate keys.
- Root-level keys are written before any section header, which some parsers (including older configparser versions) reject.
- Lists collapse into one comma-separated string; the reader must split them again.
- Null values are written as an empty value after the equals sign.
YAML to INI Converter FAQ
How deep can INI sections go?
INI only supports one level of sections, so anything nested further is flattened into dotted key names within that section.
Are lists supported in INI?
Lists are written as a single comma-separated line, since INI has no native array syntax.
Is this suitable for Python's configparser?
Yes, the output follows the same [section] / key = value structure configparser expects.
Why are some keys written with dots?
INI supports only one level of sections. Anything nested deeper than that is flattened into a dotted key such as pool.max inside the parent section so the structure remains recoverable.
Can configparser read root-level keys?
Not by default. Older versions raise a MissingSectionHeaderError. Python 3.13 adds an allow_unnamed_section option, otherwise move those keys under a section in your YAML before converting.
Are there quotes around values?
No. Values are written as plain text after the equals sign, which is what most INI readers expect. Add quotes yourself if a particular program needs them.
Is there a difference between .yml and .yaml?
No. ".yml" and ".yaml" are just two file extensions for the exact same format — this converter accepts either one, so a "yml to INI" conversion and a "yaml to INI" conversion produce identical results.
Related conversions
YAML to Properties
Prefer one flat key per line? Properties files drop the section headers entirely.
Try itYAML to TOML
Need deeper nesting and typed values while keeping a section-style layout.
Try itYAML to JSON
Moving the same settings into an API or JavaScript project.
Try itGetting an error? Check your input with theYAML Validator, or tidy it first with theYAML Formatter. You can also browse all YAML converters.