YAML to Properties (.env) Converter
Convert YAML to a Properties file online, for free, in your browser. This YAML to Properties converter flattens nested configuration from a .yaml or .yml file into dot-notated key=value pairs — the format used by Java .properties files and many .env-style configuration loaders.
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
- Nested keys are joined with dots, e.g. database.host=localhost.
- List items use bracketed indices, e.g. servers[0]=alpha.
- Values are written as plain text, so quote-sensitive values are left unescaped.
Example
site:
name: Aperture Docs
version: 1.4.2
active: true
tags:
- web
- cli
- tools
author:
name: Jane Doe
email: jane@example.com
site.name=Aperture Docs
site.version=1.4.2
site.active=true
tags[0]=web
tags[1]=cli
tags[2]=tools
author.name=Jane Doe
author.email=jane@example.com
Why flatten YAML into a .properties file
Java and its ecosystem were built around java.util.Properties, and plenty of tooling still reads flat key=value files: Spring Boot's application.properties, Log4j and logging setups, build scripts, and internationalisation bundles. If your configuration lives in a nested YAML file but a component wants a flat file, this conversion produces it directly.
The same flat style is also close to what .env files and many container platforms expect. Dot-separated keys are easy to grep, easy to override one at a time, and easy to diff, which makes them popular for environment-specific overrides.
Spring Boot overrides
Create an application.properties file from an existing application.yml.
Legacy Java components
Feed libraries that only know how to load a Properties object.
Environment variables
Use the flattened keys as the basis for .env style settings.
Easy diffs and greps
Flat lines make it simple to search for, compare or override a single setting.
How YAML maps to Properties
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.
Nested keys join with dots
The full path to every value is written on one line, joined by dots.
database:
host: localhost
port: 5432database.host=localhost
database.port=5432List items get bracketed indexes
Each element is written with its zero-based position, which Spring Boot reads back as a list.
servers:
- alpha
- betaservers[0]=alpha
servers[1]=betaNull values are left blank
A key with no value is written with nothing after the equals sign.
password: null
user: adminpassword=
user=adminLine breaks become \n
Multi-line text is kept on a single line so each property stays one line long.
message: |
Hello
Worldmessage=Hello\nWorld\nA trickier example: a Spring-style datasource
A typical application.yml fragment with a nested datasource, a list of pool names, a multi-line banner and an empty mapping.
spring:
datasource:
url: jdbc:postgresql://localhost/app
pool: [primary, replica]
banner: |
Hello
World
feature:
flags: {}spring.datasource.url=jdbc:postgresql://localhost/app
spring.datasource.pool[0]=primary
spring.datasource.pool[1]=replica
spring.banner=Hello\nWorld\n
feature.flags=Each path is flattened to a single key, the list gains index suffixes, the banner's line break is escaped and the empty mapping is written as a blank value so the key is not lost.
- Nested lists were flattened using bracketed indices, e.g. "key[0]".
Loading the properties in Java
The standard library reads the file straight into a Properties object. Note that bracketed keys such as pool[0] are ordinary key names to java.util.Properties:
Properties props = new Properties();
try (InputStream in = new FileInputStream("application.properties")) {
props.load(in);
}
String url = props.getProperty("spring.datasource.url");
String first = props.getProperty("spring.datasource.pool[0]");YAML vs Properties at a glance
Properties files are the flat cousin of YAML.
| Feature | YAML | Properties |
|---|---|---|
| Structure | Nested | Flat keys with dots |
| Lists | Native sequences | Indexed keys (key[0]) |
| Types | Numbers, booleans, null | Everything is a string |
| Comments | # comment | # or ! comment |
| Typical consumer | Kubernetes, CI, modern apps | Java, Spring, .env tooling |
Things to watch for when converting to Properties
- Every value becomes a plain string; the consuming application decides how to read numbers and booleans.
- Values are not escaped for Java-specific rules (such as leading spaces or colons in keys), so check unusual strings.
- Standard .env files use UPPER_SNAKE_CASE keys with underscores, so rename the dotted keys if your tool requires that.
- YAML comments don't survive, and key order follows the order in the YAML.
YAML to Properties (.env) Converter FAQ
Can I use this output as a .env file?
Yes, though .env files conventionally use uppercase keys, so you may want to rename keys after exporting.
Can I convert YAML to Properties in Java?
Yes. In Java, load the YAML with SnakeYAML, flatten the resulting Map, and write each entry with java.util.Properties.store(). This tool gives you the same result instantly in the browser, without setting up a Java project.
How are nested mappings flattened?
Nested keys are joined together with dots, preserving the full path to each value.
Are comments preserved?
YAML comments aren't part of the parsed data, so they aren't carried over to the output.
Will Spring Boot read the indexed list keys?
Yes. Spring Boot's relaxed binding understands keys like servers[0] and servers[1] and rebuilds the list, which is the same syntax the converter writes.
How do I turn the result into a .env file?
Replace dots and brackets with underscores and uppercase the keys, for example DATABASE_HOST=localhost. The converter keeps dotted keys so you can choose the naming convention your platform uses.
What about special characters in values?
Values are written as plain text, with line breaks escaped. If a value has leading whitespace or characters your loader treats specially, review those lines by hand before using the file.
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 Properties" conversion and a "yaml to Properties" conversion produce identical results.
Related conversions
YAML to INI
Prefer sections over fully flattened keys? INI groups related settings under headers.
Try itYAML to TOML
Keep the nested structure but drop the indentation sensitivity.
Try itYAML to JSON
Need the structured version for a JavaScript or API consumer.
Try itGetting an error? Check your input with theYAML Validator, or tidy it first with theYAML Formatter. You can also browse all YAML converters.