Java .properties formatter — one separator style, joined lines, duplicate check

Paste a Java .properties file and get every entry written with the same separator, backslash continuation lines joined, keys optionally sorted, and duplicate keys flagged.

Live demo · real result from this tool
Separator

Formatted properties

# Databasedb.url=jdbc:postgresql://localhost/appdb.user=appapp.title=Welcome to ToolsRift ! long valueapp.message=Hello, worlddb.user=admin 

Duplicate keys: db.user. java.util.Properties keeps the last value.

Processed on your device — nothing is uploaded.

How to use the Java properties formatter

  1. Paste your file into the Input box. The sample mixes =, : and space separators, a continuation line and a repeated db.user.
  2. Choose the Separator: key=value, key = value or key: value.
  3. Tick Sort keys to order entries A to Z.
  4. Read any yellow duplicate warning, then copy the Formatted properties or download app.properties.

What it does and when to use it

.properties files hold Spring Boot settings, i18n message bundles and many Java app configs. Because the format allows key=value, key: value and key value, files edited by several people end up with all three, plus long values split across lines with backslashes. This tool writes every entry the same way, and sorted keys make two environments’ files easy to compare in the code diff viewer.

The duplicate check is often the most useful part: a key defined twice silently overrides itself, which is a classic source of “my setting does not apply” bugs.

For the Java code itself, use the Java formatter. The INI formatter handles files with [sections], and the env file sorter does a similar job for .env files.

How it works

The formatter follows the rules of java.util.Properties, reading line by line in your browser:

  • Leading spaces, tabs and form feeds are ignored. Lines starting with # or ! are comments.
  • A line ending in an odd number of backslashes continues on the next line, whose leading whitespace is dropped.
  • The key ends at the first unescaped =, : or whitespace; one separator and the spaces around it are skipped.
  • Each entry is written as key, your separator, value. Blank lines between plain entries are removed.

Keys are compared exactly to find duplicates, and sorting uses English alphabetical order.

Worked examples

These are the tool’s own outputs.

The sample file. db.url : jdbc:… becomes db.url=jdbc:postgresql://localhost/app, app.title Welcome to ToolsRift becomes app.title=Welcome to ToolsRift, and the two-line message becomes app.message=Hello, world. The note says “Duplicate keys: db.user. java.util.Properties keeps the last value.”

Sorted with spaced equals signs.

! long value
app.message = Hello, world
app.title = Welcome to ToolsRift

# Database
db.url = jdbc:postgresql://localhost/app
db.user = app
db.user = admin

Both db.user lines remain; the tool flags them but never deletes data.

Escapes and a split list. greeting\ text=Hi there and list=a,\ continued over two indented lines give greeting\ text: Hi there and list: a,b,c with the colon separator.

Limits and tips

  • Duplicates are not removed. Decide which value is right and delete the other line yourself.
  • Your blank lines are not kept, except before entries that have comments.
  • Unicode escapes stay as written. é is not converted to é, or the other way.

Frequently asked questions

Is joining continuation lines safe?
Yes. In a .properties file a line ending in a single backslash continues on the next line, and the leading spaces of that next line are ignored. Joining them produces exactly the value Java would load, just on one line.
What does the duplicate warning mean?
The same key appears more than once. java.util.Properties keeps the last value it reads, so the earlier ones have no effect. Delete the copy you do not need.
Which separator should I choose?
All three are valid. key=value is the most common and the default, key = value is easier to read, and key colon value matches some older files. Pick one so the whole file is consistent.
Are comments kept when I sort?
Yes. Comment lines starting with # or ! travel with the key directly below them, and a blank line is placed before each commented entry. Comments at the very end of the file stay at the end.
Does it handle escaped spaces and backslashes in keys?
Yes. A key such as greeting\ text keeps its escaped space, and backslashes in values are copied unchanged, so Windows paths keep their doubled backslashes.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close