Skip to content

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

Untitled.yaml0 B0 lines0 characters
YAML →JSON
Your converted output will appear here.
Waiting for YAML input.

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

Input (YAML)
site:
  name: Aperture Docs
  version: 1.4.2
  active: true
tags:
  - web
  - cli
  - tools
author:
  name: Jane Doe
  email: jane@example.com
Output (ini)
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.

YAML
database:
  host: localhost
  port: 5432
INI
[database]
host = localhost
port = 5432

Top-level scalars come first

Keys that are not inside a mapping are written before any section header.

YAML
env: staging
logging:
  level: info
INI
env = staging

[logging]
level = info

Lists become comma-separated values

INI has no array syntax, so list items are joined onto one line.

YAML
server:
  names:
    - alpha
    - beta
INI
[server]
names = alpha, beta

Deeper nesting is flattened

Mappings below the section level become dotted keys inside that section.

YAML
db:
  pool:
    min: 2
    max: 10
INI
[db]
pool.min = 2
pool.max = 10

A 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.

Input (YAML)
env: staging
database:
  host: db.internal
  pool:
    min: 2
    max: 10
  replicas: [r1, r2]
logging:
  level: info
Output (INI)
env = staging

[database]
host = db.internal
pool.min = 2
pool.max = 10
replicas = r1, r2

[logging]
level = info

The 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.

Conversion notes for this example
  • 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:

python
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.

FeatureYAMLINI
NestingUnlimited depthOne level of sections
ListsNative sequencesNot supported; comma-joined text
TypesNumbers, booleans, nullEverything is a string
StandardisationFormal specificationMany dialects, no single standard
Typical useModern infrastructureDesktop 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.