Whenever I add any content in wiki page, one br tag gets appends to the end of the content before closing tag,

For e.g.

If I had header text and click on edit HTML source, it looks like

<h1>Hello World<br/></h1>

Is it a bug in SharePoint?

enter image description here

  • Why is @mohamed-el-qassas-mvp answer up-voted 5 times?! That's not an answer to the OP's question. The OP asked if this is a bug. The answer to that question is unequivocally YES. Yes it is a bug. Almost every definition of "software bug" will refer to invalid outputs or unexpected results. Mohamed's "answer" only serves to confirm the existence of this bug not offer any real solution. Additionally, Mohamed assumes the OP is using a browser extension and advises that that is what is causing the OP's issue. The OP never mentions using a browser extension and when it's mentioned that this bu
    – djlotus
    Jun 10, 2020 at 20:53

3 Answers 3


No, it's not a SharePoint bug. I faced the same behavior when I enabled a google extension like Grammarly, it considers the cursor place as a line break <br> tag.

For Example,

When you add <h1>Hello World</h1> in Source HTML

  • If you leave the cursor at the end of the word world then clicked OK, in the next Edit HTML source, you will note that a line break <br> tag has been added inside the <H1> tag. as <h1>Hello World</br></h1>

  • Now try to add the cursor outside <h1> tag, then click OK, and go back to edit the source again, you will note that a line break <br> tag has been added after the <h1>Hello World</h1></br>

So try to disable any add-ons/extension during editing the HTML Source and you will not face this issue!

  • Comments are not for extended discussion; this conversation has been moved to chat. Oct 27, 2017 at 7:49
  • How is this not a bug. Content I paste should "round trip." As long as I paste valid html, it should remain as it was.
    – Rothrock
    Jul 5, 2019 at 19:05
  • @Rothrock, Have you read the OP question first?, he didn't paste HTML, He adds text and formats it with heading! when he shows the HTML source, he got br tag! so It's not a bug, it's normal to add a new line automatically! Jul 5, 2019 at 19:49
  • I made a bad choice with "paste," but the behavior remains. If I type, edit, or paste I get unasked for <br> tags,&#160; (non-breaking space), and &8203; (zero width spaces). They break my pages and shouldn't be there.
    – Rothrock
    Jul 5, 2019 at 20:10
  • your issue is different from the OP question, you paste HTML, but he shows the HTML source after he had written his text! Please don't take any decision for upvote or downvote until reading the quest and answer accurately! Also, It would be great to add your issue in a new question and describe it in details :) Jul 5, 2019 at 20:20

Add your code as a single line or remove any indentation. The content editor will format these elements after saving them and will not create additional tags or characters.


I'm having the same issue here for my pages on my publishing site. I've come up with a clumsy solution that seems to work. This solution assumes your site is using jQuery and that you have the ability to edit Master Pages and/or Page Layouts. I have added the following javascript to my Master Page after loading jQuery:

// Only run if page is in Design Mode
var inDesignMode = document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode.value;
if (inDesignMode == "1") {
    // Only run if you are using Chrome
    if(navigator.userAgent.search("Chrome") >= 0) {
        // Find any <br> tags that are the last-child of ANY element in a rich text field
        $('.ms-rtestate-field * > br:last-child').remove();

Once this code is in your master page, you can edit a rich text field in chrome. When you first save your work, the <br> tags will still be there. Reopen the page and save immediately without editing anything. The script will then strip out the extra <br> tags. You have to do this double save every time you edit the rich text field in Chrome, but for me this is a adequate workaround.

NOTE: You may want to edit the jQuery selector to only target specific elements to prevent unwanted <br> removals.

For example:

$('.ms-rtestate-field p > br:last-child, .ms-rtestate-field h2 > br:last-child').remove();

You might also want to wrap this code in jQuery's $(document).ready() function to make sure the DOM is loaded before firing the script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.