Admin tool of the week: this post is part of a weekly series featuring small, open-source maintenance tools from the HISP Centre for DHIS2 system administrators. Read about the series.
The problem
A space at the end of a name, two spaces where there should be one, or a line break hidden inside a code: extra whitespace is invisible in most of DHIS2, but it still causes trouble:
- Look-alike duplicates. “ANC 1st visit” and "ANC 1st visit " look the same in every list, so it is easy to create or pick the wrong one.
- Broken matching. Imports, scripts and integrations that match on names or codes fail on a stray space without saying why.
- Untidy output. Double spaces show up in dashboards, reports and data entry forms.
Extra whitespace gets in through copy-pasting from spreadsheets and documents, imports and years of manual edits. Finding it through the Maintenance app means checking objects one by one.
What the tool does
Whitespace Remover Tool scans the name, short name, code and description of your metadata for extra whitespace:
- In names, short names and codes: whitespace at the start or end, two or more spaces in a row, and any line break, tab or non-breaking space. The tool replaces each of these with a single space.
- In descriptions: whitespace at the start or end and repeated spaces between words. Line breaks are kept, so paragraphs and lists stay as they are.
You get one tab per metadata type (data elements, indicators, data sets, programs, program rules, org units, category options, options and more), with the extra whitespace highlighted. Characters you can’t see get a symbol, such as ↵ for a line break.
Fixing is a two-step process:
- Check makes sure that removing the whitespace will not create a duplicate. For example, if “Stock PHU dispensed BCG” already exists, removing the double space from “Stock PHU dispensed BCG” would give two objects with the same name. The tool flags this as a conflict and leaves that object for you to sort out by hand.
- Fix removes the whitespace and saves the object. You can only fix objects that passed the check. If DHIS2 rejects a fix, the results show the reason.
You can check and fix a single object, or select many at once and use Check selected and Fix selected.

Try it on the demo instance
You can try the tool without installing anything: open implement.im.dhis2.org/tools/apps/tool-whitespace-remover and log in as tools / District1#. The demo is a copy of the Sierra Leone demo database.
Use with care
- Check where names and codes are used before you fix them. DHIS2 itself refers to metadata by ID, which the tool never changes. But data exchanges, ADX imports, imports using the code or name ID scheme, and external systems or scripts may match on the exact name or code. If they do, a fix can quietly stop data from being imported or exchanged. Only fix such objects when you can update the other side at the same time.
- The fix changes metadata in place, and the tool has no undo. Try it on a test instance first and have a backup before using it in production.
- Some values are never changed, because data or rules depend on the exact value: option codes and program rule variable names. The tool shows their whitespace in red and marks such objects Fix manually.
- Visualizations, maps and category option combinations are not included. Rename visualizations and maps in their own apps.
- The tool only sees metadata you have access to. For a complete scan, use an account with the
ALLauthority.
Get it
- Supported DHIS2 versions: 2.41 and later (tested on 2.41, 2.42 and 2.43)
- Download: Download the latest version from https://github.com/dhis2-utils/tool-whitespace-remover/releases, then install it in the App Management app (Upload app)
- Documentation and source: github.com/dhis2-utils/tool-whitespace-remover (see the user guide)
- Authorities: Export metadata to scan, and update rights plus metadata write sharing on the objects you want to fix
- Already using the older “Whitespace Cleaner Tool”? The current version is installed as a separate app. Uninstall the old one after installing it, and add the new app to the user roles that had the old one.
Questions, bugs or ideas? Reply below.
Click here to receive notifications for #admin-tool-weekly topics: 

