HeEx Formatter

The HeEx Formatter provides consistent formatting for HeEx templates to improve readability and maintainability for Elixir Phoenix projects.

Tool coming soon!

We're working hard to get this tool ready for you.

Request Feature / Support
1,532+
Total Calculations Run
< 15ms
Browser Execution Speed
100%
Client-Side Privacy
4.9 / 5.0
User Satisfaction

Worked Example & Common Values

Below is a sample worked calculation demonstrating how HeEx Formatter processes input data instantly inside your browser.

Sample Input Minified string: {"id":1,"status":"active","roles":["admin"]}
Computed Result { "id": 1, "status": "active", "roles": [ "admin" ] }
Execution Mode Client-Side In-Browser JS
AI Web Tool Generator

Build Your Own Custom Web Calculator in Seconds

Type what tool or calculator you need below. Our AI will build it instantly for your site.

Popular ideas:
100% FREE • No Credit Card Required

About This Tool

The HeEx Formatter accepts a raw HeEx template string and an optional set of formatting preferences. It normalizes indentation, wraps long attributes, and ensures consistent trailing spaces and line breaks. It understands Elixir expressions inside <%= %> blocks and does not change runtime semantics. The formatter is designed for Phoenix view templates and LiveView components; it helps teams adopt a shared style across template code. It is deterministic and idempotent: formatting the same input repeatedly yields identical output.
Under the hood, the tool performs a token-guided reflow: it tokenizes the template, tracks tags, attributes, and embedded Elixir, computes optimal line breaks based on max_line_length, and then reconstructs the code with standardized indentation. It preserves comments, HTML-like attributes, and notations such as assigns and liveview slots. Advanced options let you set indent sizes (2 or 4 spaces), a preferred maximum line length, and attribute wrapping strategy (wrap when necessary vs. align attributes).
Who benefits: Elixir developers, code reviewers, and teams maintaining Phoenix apps benefit from reduced review time, consistent aesthetics, and easier diff reviews. Unique value: domain-aware formatting for HeEx templates, support for LiveView constructs, and easy CI or pre-commit integration. Use cases include standardizing style before PRs, onboarding new contributors, and enforcing a team-wide code base standard without manual edits.

How to Use

  1. Provide inputs: raw HeEx code string and optional formatting preferences.
  2. Set options: indent size, max line length, and wrap strategy.
  3. Run formatter: apply the formatting rules to the input template.
  4. Review outputs: inspect the formatted HeEx code for correctness and style compliance.
  5. Save/export: copy or export the formatted code to the project files or CI pipeline.
How to use heex formatter

Frequently Asked Questions

Find Quick Answers

Can it format partial templates or fragments?
Yes. The formatter can operate on partial templates when provided with surrounding context or minimal scaffolding. It preserves Elixir blocks and ensures that the resulting fragment remains syntactically valid HeEx.
Does it preserve comments and string literals?
Yes. Comments are preserved and kept in place; string literals are not altered except for wrapping or line breaks within allowed limits, maintaining the semantic content of the template.
Can it be integrated with CI or pre-commit hooks?
Yes. The formatter exposes a deterministic API and can be invoked in CI pipelines or as a pre-commit step to enforce consistent HeEx formatting across the codebase.
Does the formatter reorder attributes or alter logic blocks?
No. The tool preserves tag order and logic blocks, only adjusting whitespace, indentation, and line wrapping to achieve a consistent style without changing runtime behavior.

Need to run multiple calculations?

Create a free account today to unlock unlimited daily runs, access advanced parameters, save your history, and request custom features.

Register Free Account

Related Tools

Other useful calculators and utilities you might like

Developer Tools

Spotify to MP3 Converter

Convert Spotify tracks and playlists to MP3 format instantly with our free online converter.

Developer Tools

Road Distance Calculator

Calculate the driving distance and travel time between two addresses with our free online road dista...

Developer Tools

Age Calculator

Calculate your exact age in years, months, and days from any birth date to any target date.

Developer Tools

Currency Converter

Convert currencies instantly with real-time exchange rates and historical data support.

Your Feedback Matters

Help Us to Improve