How to use the Java properties formatter
- Paste your file into the Input box. The sample mixes
=,:and space separators, a continuation line and a repeateddb.user. - Choose the Separator:
key=value,key = valueorkey: value. - Tick Sort keys to order entries A to Z.
- 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?
What does the duplicate warning mean?
Which separator should I choose?
Are comments kept when I sort?
Does it handle escaped spaces and backslashes in keys?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.