Overview
Introduction
INI files are still common for legacy application config, desktop software settings, and simple service definitions, but a lot of modern tooling expects YAML instead. This tool parses INI's [section]-and-key=value syntax and re-expresses it as a nested YAML document.
It reuses this site's existing, already-tested INI parser rather than a second hand-rolled one, so results stay consistent with the INI-to-JSON and INI/XML converters elsewhere on this site.
What Is INI to YAML?
An INI-to-YAML converter reads INI text line by line, tracking an implicit global section for any key=value pairs that appear before the first [section] header, and a nested object per [section] header afterward.
The resulting plain JavaScript object, one level of nested mappings at most, is then serialized as YAML using the same stringifier every other tool in this category uses.
How INI to YAML Works
Each line is trimmed and classified: blank lines and lines starting with ; or # are skipped as comments, a line matching [name] opens a new section (a new nested object assigned onto the root under that name), and any other line is split at its first = into a key and value.
Key/value pairs are written into whichever object is currently active: the root object if no section has been opened yet, or the most recently opened section's object otherwise. Any line that isn't a comment, a section header, or a key=value pair is reported as a parse error naming its line number.
When To Use INI to YAML
Use it when migrating a legacy INI-based config (a desktop app's settings file, an old PHP or Python service's config.ini) into a YAML-based project.
It's also useful for quickly previewing what an INI file's global keys and sections look like once flattened into YAML's indentation-based structure, before committing to a full migration.
Often used alongside INI to JSON Converter, ENV to YAML and YAML Formatter & Prettifier.
Features
Advantages
- Reuses this site's already-tested decodeIni parser, so behavior matches the INI-to-JSON and INI/XML converters exactly rather than diverging.
- Correctly distinguishes global (pre-section) keys from section-scoped keys, matching how most INI readers interpret file order.
- Reports a clear, line-numbered error for any line that isn't a comment, section header, or key=value pair.
- Runs entirely client-side, so configuration values never leave your browser.
Limitations
- Only one level of section nesting is supported; INI dialects with dotted section names implying sub-sections aren't reconstructed as deeper nesting.
- Every value is kept as a string, since INI has no native type system, so numeric- or boolean-looking values are quoted in the YAML output rather than converted to actual numbers or booleans.
- Trailing (inline) comments after a value on the same line aren't stripped, since INI implementations disagree on whether and how those are supported.
Examples
Best Practices & Notes
Best Practices
- Keep any global (pre-section) settings at the very top of your INI file, since this tool (like most INI readers) treats file order as meaningful for what counts as global.
- Review quoted-looking values (like "true" or "8080") in the output, they're intentionally kept as strings, and you may want to manually convert specific ones to real YAML booleans or numbers.
- Run the result through the YAML Formatter afterward if you want to double-check indentation consistency.
Developer Notes
This tool is intentionally thin: it imports decodeIni directly from the xml category's ini-core.ts module (the same parser backing ini-to-json, json-to-ini, ini-to-xml-converter, and xml-to-ini-converter) rather than reimplementing INI parsing a third time, then pipes the parsed object straight into toBlockYaml from this category's shared yaml-core.ts.
INI to YAML Use Cases
- Migrating a legacy desktop application's .ini settings file into a YAML-based config format
- Converting an old PHP or Python service's config.ini into YAML for a modern deployment pipeline
- Previewing an INI file's section structure as nested YAML before a format migration
- Generating YAML fixtures for tests from an existing INI source file
Common Mistakes
- Expecting values like "true" or "8080" to come out as real YAML booleans or numbers, they're kept as quoted strings, since INI itself has no type system to infer from.
- Placing a key=value line after a [section] header when it was meant to be global, it will be attached to that section instead, since section scope is purely based on line order.
- Assuming multi-level section nesting (like [a.b]) will produce nested YAML mappings two levels deep, only one level of section nesting is supported.
Tips
- If your INI file has settings meant to be global, move them above every [section] header before converting.
- Use Sort YAML afterward if you want the converted mapping's keys in alphabetical order rather than source-file order.
- Pair with YAML Validator to double-check the converted output before feeding it into another tool.