Search...Search plugins and themes...
⌘K
Sign in
  • Get started
  • Download
  • Pricing
  • Enterprise
  • Account
  • Obsidian
  • Overview
  • Sync
  • Publish
  • Canvas
  • Mobile
  • Web Clipper
  • CLI
  • Learn
  • Help
  • Developers
  • Changelog
  • About
  • Roadmap
  • Blog
  • Resources
  • System status
  • License overview
  • Terms of service
  • Privacy policy
  • Security
  • Community
  • Plugins
  • Themes
  • Discord
  • Forum / 中文论坛
  • Merch store
  • Brand guidelines
Follow us
DiscordTwitterBlueskyThreadsMastodonYouTubeGitHub
© 2026 Obsidian

Trim Whitespace

zlovattzlovatt14k downloads

Trim unnecessary whitespace.

Add to Obsidian
  • Overview
  • Scorecard
  • Updates8

Trim Whitespace trims unnecessary blank characters from your Obsidian documents. This is a common feature in code editing software, and mostly exists to pare down irksome document clutter.


Features

The plugin operates on three different types of whitespace, with three different targets.

Whitespace Types

  1. Spaces - The space character, ( , stylised as ·)
  2. Tabs - The tab character, (\t or , stylised as →)
  3. Lines - Newline character, either, (\r or \n, stylised as ¬)

Targets

Trailing

Trim whitespace at the end of each line, or open document.

Before After
Hello·World!····
Hello·World!
Hello·World!→→→
Hello·World!
# Hello¬
¬
World!¬
¬
¬
# Hello¬
¬
World!¬

Leading

Trim whitespace at the start of each line, or open document.

Before After
····Hello·World!
Hello·World!
→→→Hello·World!
Hello·World!
¬
¬
# Hello¬
¬
World!¬
# Hello¬
¬
World!¬

Multiple

Trim groups of whitespace (2 or more consecutive inline spaces/tabs, or consecutive lines)

Before After
Hello···World!
Hello·World!
Hello→→→World!
Hello→World!
# Hello¬
¬
¬
World!¬
¬
¬
# Hello¬
¬
World!¬

Commands

  • Trim whitespace in document trims all whitespace in the active document, according to the settings below
  • Trim whitespace in selection trims all whitespace in the selected region in the active document, according to the settings below

Trim Whitespace also adds a ribbon button to trim document whitespace. Hold shift when clicking the button to trim whitespace in selection instead.


Settings

Name Description
Trim on Manual Save Manually trim document with CTRL / CMD + S
Auto-Trim Automatically trim document when modified, according to the settings below.
Auto-Trim Delay Time to wait in seconds before auto-trimming.
Preserve Code Blocks Whether to preserve whitespace within code blocks.
Trim Trailing Spaces Trim spaces at the end of each line.
Trim Trailing Tabs Trim tabs at the end of each line.
Trim Trailing Lines Trim empty lines at the end of the document.
Preserve Indented Lists Whether to preserve whitespace if used for list indentation.
Trim Leading Spaces Trim spaces at the start of each line.
Trim Leading Tabs Trim tabs at the start of each line.
Trim Leading Lines Trim lines at the start of the document.
Trim Multiple Spaces Trim groups of multiple inline spaces.
Trim Multiple Tabs Trim groups of multiple inline tabs.
Trim Multiple Lines Trim groups of multiple blank lines.

Installation

To install, either:

  1. Download from the Obsidian Community Plugin library, or
  2. Install manually with the zip in Releases

Known Bugs

  • Trimming the whole document doesn't reset cursor position properly, if the original location started before the first non-space character in the document.

Contribution

Want to help develop or maintain this plugin? Please do! PRs and input extremely welcome!


Credit Due

  • Community interest sparked by this forum post
  • Plugin basics grokked from @Benature's obsidian-text-format
  • Lots of support from the Obsidian Community Discord server
68%
HealthGood
ReviewCaution
About
Trim unnecessary blank characters—spaces, tabs, and extra blank lines—from your notes. Target trailing, leading, or multiple consecutive whitespace in a document or selection, preserve code blocks and indented lists, and run manually or automatically.
FormattingEditingAutomation
Details
Current version
0.4.1
Last updated
6 months ago
Created
4 years ago
Updates
8 releases
Downloads
14k
Compatible with
Obsidian 0.14.15+
Platforms
Desktop, Mobile
License
MIT
Report bugRequest featureReport plugin
Author
zlovattzlovatt
github.com/zlovatt
GitHubzlovatt
  1. Community
  2. Plugins
  3. Formatting
  4. Trim Whitespace

Related plugins

Linter

Format and style your notes. Linter can be used to format YAML tags, aliases, arrays, and metadata; footnotes; headings; spacing; math blocks; regular Markdown contents like list, italics, and bold styles; and more with the use of custom rule options.

Easy Typing

Auto format when typing.

List Callouts

Create simple callouts in lists.

MetaEdit

Manage your metadata.

Advanced Tables

Improved table navigation, formatting, and manipulation.

QuickAdd

Quickly add new notes or content to your vault.

Templater

Create and use dynamic templates.

Homepage

Open a note, base, or workspace on startup, or set it for quick access later.

BRAT

Easily install a beta version of a plugin for testing.

Meta Bind

Make your notes interactive with inline input fields, metadata displays, and buttons.