FormatForge

TOML to INI Converter

Convert TOML configuration files to INI format instantly. Enable backward compatibility with legacy INI-based applications. Free, secure, and works entirely in your browser.

TOML
INI

Drop a file here or click to upload

Supports .toml files

Understanding TOML and INI

TOML (Tom's Obvious, Minimal Language) is a modern configuration format with explicit typing, nested tables, and arrays of tables. It was designed as an improvement over INI's limitations while keeping the same spirit of simplicity. TOML is used by Rust's Cargo, Python's pyproject.toml, and Hugo, among many other tools. For a full reference on TOML syntax and features, visit our TOML guide.

INI (Initialization) is one of the oldest configuration file formats, dating back to early Windows and MS-DOS. INI files use a simple structure of sections (denoted by square brackets) containing key-value pairs separated by equals signs. The format has no formal specification, which means different parsers handle edge cases differently. Despite its age, INI remains widely used in PHP configuration (php.ini), MySQL (my.cnf), Git (.gitconfig), systemd unit files, and countless Windows applications. For more details on INI conventions, see our INI guide.

Converting from TOML to INI is essentially a downgrade from a richer, typed format to a simpler, flat one. This trade-off is worthwhile when you need compatibility with legacy systems that only understand INI, or when you want the absolute simplest configuration format for a straightforward use case.

Why Convert TOML to INI?

While TOML is more capable than INI, there are legitimate reasons to convert modern TOML configurations to the simpler INI format:

  • Supporting legacy Windows applications. Many older Windows desktop applications, games, and utilities read their settings from INI files. If you maintain configurations in TOML for your modern toolchain but need to deploy settings to these legacy apps, conversion is essential.
  • Generating php.ini or MySQL my.cnf files. PHP and MySQL use INI-style configuration. If your infrastructure-as-code defines settings in TOML, converting to INI lets you deploy runtime configurations for these services without manual formatting.
  • Simplifying configuration for embedded systems. Resource-constrained devices and embedded systems often use INI parsers because they are trivially simple to implement. Converting TOML to INI ensures compatibility with these minimal environments.
  • Creating human-editable configuration for non-technical users. INI is arguably the simplest configuration format to understand. Converting TOML to INI can make configuration files more accessible to users who are not familiar with TOML's table and array syntax.

How the Conversion Works

TOML-to-INI is a cross-format conversion that uses JSON as an intermediate representation. Since INI is a simpler format than TOML, some information is necessarily simplified during the conversion:

  1. Parse the TOML input using smol-toml, validating syntax and extracting typed values including tables, arrays, strings, numbers, booleans, and dates.
  2. Convert to JSON intermediate. The TOML structure is represented as a JSON object tree, with tables as nested objects and arrays as JSON arrays.
  3. Flatten nested structures. Since INI only supports one level of sections, nested TOML tables are flattened. A table like [database.pool] becomes the INI section [database.pool] with dot notation in the section name.
  4. Serialize values as strings. All TOML values are converted to their string representations. Booleans become true/false, numbers keep their numeric form, and arrays are joined with commas.
  5. Emit INI output with sections and key-value pairs formatted as standard INI.

The table below summarizes how TOML constructs are represented in INI:

TOML ConstructINI Representation
[server][server] (section header)
port = 8080port=8080
[server.ssl] (nested table)[server.ssl] (dotted section name)
tags = ["a", "b"]tags=a,b (comma-separated)
enabled = trueenabled=true

Before and After Example

Below is a practical example showing a TOML application configuration and the simplified INI equivalent after conversion.

Input TOML

[general]
app_name = "MyApp"
version = "2.0.1"
debug = false

[server]
host = "localhost"
port = 3000
workers = 4

[database]
driver = "mysql"
host = "db.local"
port = 3306
name = "app_db"

[logging]
level = "info"
file = "/var/log/myapp.log"
max_size = 10

Output INI

[general]
app_name=MyApp
version=2.0.1
debug=false

[server]
host=localhost
port=3000
workers=4

[database]
driver=mysql
host=db.local
port=3306
name=app_db

[logging]
level=info
file=/var/log/myapp.log
max_size=10

Notice how the TOML tables map directly to INI sections, and key-value pairs translate cleanly. The structure is simplified -- string quotes are removed, and all values become plain text. This INI file is immediately compatible with any INI parser, from Python's configparser to PHP's parse_ini_file.

Tips and Best Practices

Keep TOML structure flat for cleanest output

INI works best with a single level of sections. If your TOML has deeply nested tables (three or more levels), the resulting INI section names will be long dotted paths like [server.database.pool]. Consider flattening your TOML structure before converting for more readable INI output.

Be aware of type information loss

INI treats all values as strings. TOML integers like port = 8080 and booleans like debug = false will look the same in INI but lose their type information. When reading the INI file, the consuming application must handle type parsing on its own.

Handle arrays carefully

TOML arrays are converted to comma-separated values in INI. If your array values themselves contain commas, this can cause parsing ambiguity. Consider whether your target INI parser supports multi-value keys or if you need to use a different serialization strategy for arrays.

Test with your target INI parser

Since INI has no formal specification, different parsers handle edge cases differently. Some parsers support comments with #, others with ;. Some support quoted values, others do not. Always test the converted INI output with the specific parser your application uses.

Consider TOML-to-INI as a one-way simplification

While you can convert INI back to TOML, the round trip is not lossless. TOML features like typed values, inline tables, multi-line strings, and date/time types cannot be recovered from INI. Treat the INI output as a simplified view of the original TOML configuration.

Related Tools

Explore other converters and resources that complement TOML-to-INI conversion:

How to Convert TOML to INI

  1. Paste your TOML data in the input area, or upload a TOML file
  2. Click the "Convert" button
  3. View the converted INI output instantly
  4. Copy the result or download it as a file

Features

  • 100% client-side - your data never leaves your browser
  • No login or registration required
  • Instant conversion with real-time preview
  • Supports file upload and drag-and-drop
  • Download converted files directly
  • Works on mobile and desktop

Frequently Asked Questions

How does TOML to INI conversion work?

The converter parses your TOML data into a JSON intermediate representation, then transforms that JSON into INI format. TOML tables become INI sections (bracketed headers), and key-value pairs become INI key=value entries within those sections.

Why convert TOML to INI?

INI is one of the simplest and most widely supported configuration formats, especially in legacy Windows applications, PHP (php.ini), MySQL (my.cnf), and embedded systems. Converting TOML to INI enables backward compatibility with these older platforms.

What TOML features are lost when converting to INI?

INI is a flat format that does not natively support nested structures, typed values, or arrays. Deeply nested TOML tables are flattened using dot notation in section names, arrays are serialized as comma-separated values, and all values become strings. TOML date/time types lose their type information.

How are TOML arrays of tables handled?

TOML arrays of tables ([[items]]) are converted to numbered INI sections. For example, [[servers]] entries become [servers.0], [servers.1], etc. This preserves the data while adapting to INI's flat structure.

Is my data secure during conversion?

Yes. All processing happens entirely in your browser using client-side JavaScript. Your TOML data is never transmitted to any server, stored remotely, or logged in any way. The tool functions even when offline.

Can I convert back from INI to TOML?

Yes. FormatForge offers an INI to TOML converter as well. However, since INI does not store type information, values that were integers or booleans in the original TOML may need manual type correction after round-tripping through INI.