A Dockerfile formatter normalizes Docker build instructions with proper uppercase keywords, indented continuation lines, and blank lines between logical groups. Whether cleaning up generated Dockerfiles or enforcing team style, this tool follows Dockerfile best practices for readability and maintainability.
Formatted Dockerfile will appear here...
Example Dockerfiles
How to Use the Dockerfile Formatter
Inconsistent Dockerfile formatting leads to unclear build layers, hard-to-review diffs, and missed best-practices violations. A Dockerfile formatter applies standard conventions automatically: uppercase instruction keywords, indented continuation lines, and blank lines separating logical stages. This is essential before code reviews or adding a Dockerfile to a team repository.
Step 1: Paste Your Dockerfile
Copy your Dockerfile content and paste it into the input area. The formatter accepts any valid Dockerfile syntax including FROM, RUN, COPY, ADD, ENV, EXPOSE, WORKDIR, CMD, ENTRYPOINT, ARG, LABEL, VOLUME, USER, and HEALTHCHECK instructions.
Step 2: Choose Indentation Width
Select your preferred indentation for continuation lines: 2 spaces for compact output or 4 spaces for explicit visual grouping. Then click Format to apply all formatting rules.
Step 3: Review and Copy or Download
The formatted Dockerfile appears on the right with syntax highlighting. Click Copy to place it on your clipboard or Download to save as a Dockerfile directly. The output shows line and character counts so you can verify nothing was lost.
Dockerfile Formatting Rules Applied
The formatter applies these standard Docker best practices: instruction keywords are uppercased (FROM, RUN, COPY, WORKDIR); continuation lines beginning with backslash are indented under their parent instruction; blank lines are inserted between logical groups (base image, package installs, file copies, runtime config); and ENV/ARG spacing is normalized. Use Minify to produce the most compact inline form for automated pipelines.
FAQ
Is the Dockerfile formatter free?
Yes, completely free with no signup required. Format unlimited Dockerfiles directly in your browser.
Is my Dockerfile data safe?
Yes. All formatting runs locally in your browser. Your Dockerfile content is never sent to any server.
What does the Dockerfile formatter change?
It uppercases instruction keywords (FROM, RUN, COPY, etc.), indents continuation lines under their parent instruction, adds blank lines between logical groups, and normalizes spacing in ENV and ARG instructions.
Does the formatter change my Dockerfile logic?
No. The formatter only adjusts whitespace, casing of instruction keywords, and line organization. The build behavior remains identical.
Can I minify a Dockerfile?
Yes. The Minify option merges continuation lines, removes comments, and collapses blank lines to produce the most compact Dockerfile possible.
What is a Dockerfile continuation line?
A continuation line is a line ending with a backslash (\) that continues the previous instruction. The formatter indents continuation lines under their parent instruction for readability.