This tutorial explains how to change and configure the Maximum line length in PyCharm IDE.

Let’s a variable declared with a string value and line length is 154 characters. The code editor throws an underlined warning PEP 8: E501 line too long (154 > 120 characters) as per the given screenshot.

pycharm line length warning

How to fix PEP 8: E501 line too long warning

Pycharm IDE is similar to Intelli IDE, So the Default Line line is 120 characters per line in both editors.

Sometimes we want to limit or increase the number of characters per line.

PyCharm uses a PEP8 checker to check a given line length and throws a warning if the length is more than 120 characters.

To remove the PEP8 E501 warning, You have to configure the below steps to ignore this warning and

    • Open PyCharm editor, and open or create a Project

pycharm open

  • Open the File menu and Select Settings, Settings window shown to the user

pycharm settings

  • Click Editor, and Select the Inspections tab
  • Shows list of options, Select Python and select PEP8 coding style violation
  • Select + Button on ignore errors
  • It shows the entered input text box and enter the E501 value and click on the Apply button

![pycharm settings PEP8 coding style violation](/images/editors/pycharm/ pycharm-python-pep8-e501.png)

  • Now, the warning is resolved and not shown to the user.

How to limit the maximum length of characters in a line

In Code editor, if the line length is more than 120 characters, It shows a Vertical line as given below.

pycharm Maximum character lengthh vertical bar

Let’s see how to change the line length to 80 characters from the default 120 characters.

  • Open File Menu, Select Settings, and Settings window shown to the user

pycharm settings

  • Select Editor -> Code Styles on the Right margin option
  • Enter values for
    • Hard Wrap to 80
    • Visual Guides for wrapping to 80
    • Check on Wrap on Typing

pycharm settings

  • Finally, Save it.
  • Next select Other file types under the child element of the Code Styles Option such as Python, HTML, and Javascript -Now, It allows up to 80 characters max per line and wraps to a new line for more than 80 characters in length.