Title: Visual editor changes HTML formatting
Last modified: August 18, 2017

---

# Visual editor changes HTML formatting

 *  [fotkin](https://wordpress.org/support/users/fotkin/)
 * (@fotkin)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/visual-editor-changes-html-formatting/)
 * when I switch between visual and text version of the page, change HTML formatting,
   and then switch to visual to see if everything is OK, then switch back to HTML,
   and all my HTML formatting is gone. is there a way to stop TinyMCE from doing
   so?

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [8 years, 7 months ago](https://wordpress.org/support/topic/visual-editor-changes-html-formatting/#post-9459402)
 * Jumping in because I had the same issue. [@fotkin](https://wordpress.org/support/users/fotkin/)
 * May be worth checking the settings for the plugin at [http://www.MYSITE.COM/wp-admin/options-general.php?page=tinymce-advanced](http://www.MYSITE.COM/wp-admin/options-general.php?page=tinymce-advanced)
   and the “advanced options” area. Specifically looking at the “Keep paragraph 
   tags” option. Once I unchecked it, it seemed to work fine and as expected again.
 *  Thread Starter [fotkin](https://wordpress.org/support/users/fotkin/)
 * (@fotkin)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/visual-editor-changes-html-formatting/#post-9460218)
 * I did a little research about this… and turns out, that when you switch from 
   text view to a visual view, TinyMCE parses your content into DOM, and it doesn’t
   care what you had in your HTML… then when you switch back to Text view, it converts
   DOM back to HTML, wiping all your formatting and stuff 🙁
 * I looked around, and looks like there is no way to stop this behavior. And may
   be it is even a good way getting rid of different HTML errors users might make
   while poking around with it 🙂
 * So, I ended up with keeping HTML locally on my computer, was using Atom to edit,
   and then when I was ready, I copied and pasted to WordPress 🙂
 * Would be great if WordPress would save original HTML somewhere in the database,
   together with formatting and comments… Btw, may be there is Plugin for that? 
   🙂 Or, if not, may be someone can develop one!
 *  [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * (@mbrsolution)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/visual-editor-changes-html-formatting/#post-9471148)
 * [@fotkin](https://wordpress.org/support/users/fotkin/), I just carried out a 
   test and it works well for me. I suspect that you might have a conflict with 
   your theme or a plugin.
 * For the theme you might like to test one of WordPress default themes like Twenty
   Fifteen or Sixteen. If it is not the theme, then you can disable all of your 
   other plugins and carry out a test.
 * Let me know how you go.
 * Regards
 *  Thread Starter [fotkin](https://wordpress.org/support/users/fotkin/)
 * (@fotkin)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/visual-editor-changes-html-formatting/#post-9476441)
 * [@mbrsolution](https://wordpress.org/support/users/mbrsolution/) take a look 
   at the video I have recorded:
 * I switched off all plugins and changed theme to default one, and still can not
   preserve HTML, very annoying…
 *  [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * (@mbrsolution)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/visual-editor-changes-html-formatting/#post-9477733)
 * [@fotkin](https://wordpress.org/support/users/fotkin/), I now see what you mean.
   I believe that is how WordPress formats the bulleted list. If you want to change
   the style you need to use a third party plugin or add your own customization 
   in your child theme. You might like to read the following [documentation](https://premium.wpmudev.org/blog/how-to-create-custom-bullet-points-in-wordpress/).
 * In regards to paragraph and line space did you enable the following feature **
   Keep paragraph tags** in the plugin?
 * Regards
 *  Plugin Author [Andrew Ozz](https://wordpress.org/support/users/azaozz/)
 * (@azaozz)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/visual-editor-changes-html-formatting/#post-9479854)
 * > all my HTML formatting is gone
 * I’m assuming you mean all the “white space” from the HTML source.
 * > …when you switch from text view to a visual view, TinyMCE parses your content
   > into DOM, and it doesn’t care what you had in your HTML… then when you switch
   > back to Text view, it converts DOM back to HTML, wiping all your formatting
   > and stuff.
 * This is correct, and is not really TinyMCE doing it, it’s the browser. How else
   would you see a “preview” of the HTML 🙂
 * White space doesn’t matter in the HTML source. All spaces, tabs, line breaks,
   etc. are rendered as a single space when you load it in the browser. There is
   really no good way to take some HTML source, load it in a browser (convert to
   a DOM), then extract the source out of that DOM and preserve the previous spaces.
 *  Thread Starter [fotkin](https://wordpress.org/support/users/fotkin/)
 * (@fotkin)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/visual-editor-changes-html-formatting/#post-9479889)
 * Would be great (may be there is a WordPress plugin called Preserve HTML) that
   saves original HTML somewhere into database 🙂 But I understand that as soon 
   as you make changes in visual editor, TinyMCE needs to recreate HTML from DOM,
   and it doesn’t care about formatting and HTML comments and the rest of the stuff
   🙂
 * I solved this issue by saving original HTML files locally and was using Atom 
   Editor to edit them, so we can close this issue… But Google will bring a lot 
   of people who are having the same problem… 🙂
 *  Plugin Author [Andrew Ozz](https://wordpress.org/support/users/azaozz/)
 * (@azaozz)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/visual-editor-changes-html-formatting/#post-9479916)
 * > …as soon as you make changes in visual editor, TinyMCE needs to recreate HTML
   > from DOM, and it doesn’t care about (source) formatting…
 * Right, it’s not that it doesn’t care, but the HTML source is now different and
   the previous “white space” is gone. Frankly I don’t like that too, but that’s
   the way browsers work 🙂
    -  This reply was modified 8 years, 7 months ago by [Andrew Ozz](https://wordpress.org/support/users/azaozz/).

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Visual editor changes HTML formatting’ is closed to new replies.

 * ![](https://ps.w.org/tinymce-advanced/assets/icon-256x256.png?rev=971511)
 * [Advanced Editor Tools](https://wordpress.org/plugins/tinymce-advanced/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tinymce-advanced/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tinymce-advanced/)
 * [Active Topics](https://wordpress.org/support/plugin/tinymce-advanced/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tinymce-advanced/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tinymce-advanced/reviews/)

## Tags

 * [html](https://wordpress.org/support/topic-tag/html/)

 * 8 replies
 * 4 participants
 * Last reply from: [Andrew Ozz](https://wordpress.org/support/users/azaozz/)
 * Last activity: [8 years, 7 months ago](https://wordpress.org/support/topic/visual-editor-changes-html-formatting/#post-9479916)
 * Status: not a support question