Heading Level Normalizer

Normalize inconsistent heading levels in LLM-generated markdown.

Detects and fixes heading level jumps (such as H1 jumping straight to H4) and optionally normalizes heading capitalization in LLM markdown output. Produces a clean, properly nested heading hierarchy ready to publish. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What heading problems does it fix?

It removes level jumps so headings never skip a level — an H1 followed by an H4 becomes H1 then H2. It also strips trailing hashes, collapses extra spaces after the hashes, and can normalize capitalization.

LLMs love headings but are sloppy about levels — an # H1 followed straight by a #### H4, inconsistent capitalization, stray trailing hashes. Those gaps break document outlines, hurt accessibility, and look amateurish. This tool rewrites the heading hierarchy so it never skips a level, and optionally tidies capitalization, all in your browser.

Why heading jumps are a real problem

A well-formed heading hierarchy serves three audiences simultaneously: sighted readers who scan a page’s structure, screen-reader users who navigate by headings, and search engines that use heading levels as relevance signals. When an LLM jumps from ## Introduction straight to ##### Key Terms, the document outline breaks. Screen readers announce headings by level, so a listener navigating by heading would skip from level 2 straight to level 5, missing the implied structure entirely. Most CMSs and static-site generators also emit heading-based tables of contents that silently collapse or look wrong when levels skip.

How it works

The tool finds every ATX heading (#, ##, …) and walks the document top to bottom. It tracks the current depth and never allows a heading to sit more than one level below its parent: a jump from H1 to H4 is pulled back up to H2, preserving the relative nesting without leaving gaps. It also normalizes the heading syntax — single space after the hashes, no trailing hashes — and can apply Title Case or Sentence case to the text. Non-heading lines pass through untouched.

Before and after example

Consider this raw LLM output:

# Project Overview ##

#### Background

## Goals

##### Success Metrics

After normalization (with H1 demotion off):

# Project Overview

## Background

## Goals

### Success Metrics

The trailing ## on the H1 is stripped, the orphaned H4 is promoted to H2 (one level below the H1), and the H5 under ## Goals becomes H3 — one level deeper than its parent.

Options

  • Demote leading H1 — useful when the markdown will live under a page that already provides the page H1.
  • Capitalization — keep as-is, Title Case, or Sentence case across all headings.

Tips

  • Run this as the last step before publishing so manual edits don’t reintroduce jumps.
  • Keep a single H1 per page for SEO and screen-reader navigation — enable demotion for embedded snippets.
  • The tool only touches heading lines, so code fences and body text are always preserved exactly.
  • If your CMS interprets heading levels to build navigation menus, run this tool before pasting to avoid menu gaps.
  • Sentence case is often the better default for technical documentation: it reads naturally and avoids the visual noise of Title-Cased Every Single Word in every heading.
  • If you plan to run the content through a table-of-contents generator next, normalizing heading levels first ensures the TOC hierarchy matches the document structure.