This tutorial explains How to do Python Indentation in Notepad++.
Notepad++ is a simple editor, not a full-featured IDE, It will not do auto indentation by default.
First, You need to indent the first line manually, Notepad++ auto indents subsequent lines automatically.
Multiple ways we a do auto-indentation of Python code in Notepad++
- using plugin
- Settings
Settings
For the new and latest version
- Open Notepad++ Editor
- Go to
SettingsMenu - Select
PreferencesItem, Popup Window opened - Select the
Auto CompletionTab, and Check theAuto indentcheckbox to do automatic indentation as per the below screenshot - Restart Notepad++

Another way, if the above option is not shown for older versions, please follow the below steps
- Go to
SettingsMenu - Select
PreferencesItem, Popup Window opened - Select the
MISCTab, check the Auto Indent checkbox - Restart Notepad++
Python plugin to auto-indent
- Select
pluginsMenu, SelectPlugin Admin - Search
Pythonand select thePython indentplugin as given below - Click the Install button to install the plugin

- Once installed, next enable it
- Select the
PluginsMenu, Select thePython Indentitem, and CheckEnableoption - Restart Notepad++