Free tech support / small logo


How do I use TextEdit with HTML files on Mac OS X?

I wrote all of my web site's code using SimpleText in MacOS 9. Recently I made the step up to OS X and I've transferred all of my data from my old G-4 to the new system. When I open the html pages in TextEdit on OS X I am unable to go in and edit the code. Instead I get a screen that reads the the html and presents a page like one would see on the web. Is it possible to edit the html that was written in SimpleText and still keep it as a text file?


Dave's Answer:

There are a couple of ways you can address this problem. First off, in Mac OS X, files with ".html" filename suffixes are automatically associated with Safari, the Web browser, so if you double click on them, you don't get to an editor at all.

To open a file in your editor, Control-Click on the file's icon. You'll see:

Mac OS X Open With... menu

You can see here that, oddly enough, I have three different versions of TextEdit on my own computer running Mac OS X Tiger 10.4.2. Weird!

Anyway, that's the general technique you can use to open any file in Mac OS X with any of the set of applications that are known to handle that particular file type.

To permanently change all ".html" files to open with TextEdit, instead of choosing "Open With..." you should choose "Get Info..." which reveals the following:

Mac OS X Get Info window

Notice the "Open with" area in the Get Info window. As you can see, the default is to open this file -- and all files with this matching filename extension -- with Safari. You can change that by selecting another application from the pop-up menu, then clicking Change All....

Now, on to the specifics of your question. You ask why it is when you open up an HTML file that TextEdit shows you the formatted text rather than the actual HTML source. Great question!

Here's what I see when I open a simple HTML file:

TextEdit showing formatted HTML rather than source

Not good. To fix this we're going to have to change the Preferences, then quit and re-open the file. Fortunately, we'll only have to do this once on your Mac. Go to TextEdit --> Preferences... and choose "Open and Save". You'll see:

TextEdit Preferences

The key is the first option under "When opening a file": you want to check Ignore rich text commands in HTML files. Check that option, then quit TextEdit.

Now, open up the HTML file again, and here's what you'll see:

TextEdit showing HTML source

Much, much better.

It turns out you can also do this by manually selecting File --> Open..., choosing the file, and also selecting the option in the Open dialog window of "Ignore rich text commands", but since i'm always double-clicking on files or otherwise launching TextEdit, it's a much easier solution to simply fix the preferences and never worry about it again.

Kind of a pain, but that's your solution path. Good luck with your editing!









Subscribe!
Never miss another Q&A article! Click to subscribe: Add to Google Reader Add to My Yahoo! Subscribe in NewsGator RDF XML
Comments

Dear Dave, i use a mac OSX(10.3) to do my site. Recently, i thought of purchasing a CGI script for my site but i have no idea, can a CGI script work with mac? I'm not a techie so need your help. Thanks mate!

Posted by: Philip at October 1, 2007 7:31 PM

Dave, you're a sanity-saver. I was going spare trying to write website stuff on my newly acquired Mac. It's so much easier on Windows. Will buy you a chai soon (promise), when I've recovered from Mac-trauma.

Posted by: gerrydunlop at January 29, 2008 8:20 AM

This is weird indeed. When I open an HTML file, TextEdit looses a couple of my CSS styles. So I decided to untick the box and to display all the HTML code.
The thing is that when you untick this box, you cannot save the html file as webarchive any longer. Annoying...
(trying to make a signature for Mail)

Posted by: Axel at March 7, 2008 6:13 AM

I don't know why this did not work for me, I tried everything with no success.
I have OS X 10.4.11. When I try to open the ".html" file with TextEdit 1.4, I get a blank white screen....very frustrating.
Then I remember that you can double click to open the ".html" file which opens your default browser, (I was using Safari) click View > View Source and then you can see the "html" text... hope this helps :)

Posted by: chris at April 3, 2008 10:24 AM

IT Works!!!!

NEXT STEP ... copy the ".html" text and paste into new TextEdit file and save over your old file in the same location!
I found out that I could only edit the ".html" text in a new TextEdit file.

Posted by: chris at April 3, 2008 11:01 AM

Thanks for the help. That solved my problem immediately. Why does Apple not make this the default ?

Posted by: scott at June 14, 2008 3:39 PM

Perfect! Thanks!

Posted by: Julie at October 16, 2008 1:57 PM

Thank you! This has been a bigger and bigger thorn in my side as my family has slowly migrated more and more of our pcs to macs. I can work from home again!

I agree with a previous commenter, why isn't plain text the default? If we want to see what it looks like in HTML, we can open a browser.

Posted by: Lori at December 6, 2008 3:13 PM

Thanks, very big thanks

Posted by: Magnus Janson at December 18, 2008 3:00 PM

YAY! I was getting very frustrated with this problem, and your page was the first thing to come up in Google. It WORKED, and I am thrilled. THANK YOU!

Posted by: Johanna at December 28, 2008 12:05 PM

Thank you very much..saved my day..!!

Posted by: Alberto at January 26, 2009 11:48 AM

Dave,

I accidentally trashed a memory stick containing vital data and text. The stick was written with SimpleText on Mac OS 9.2.2 I was unable to find any software to recover the files on 9.2.2 but I have recovered them with DataRescue on Mac OS 10.4.11 They only open with TextEdit as in the following examples

Posted by: Ron Barnes at February 19, 2009 4:42 AM

This tip is a sanity saver! I'm used to using Notepad and was about to give up on TextEdit. I have one more problem when using TE for HTML. No images show up, even thought my path and spelling of the file name is correct. Neither a page background image or an inline image will show. Any ideas?

Thanks

Posted by: Diana at February 20, 2009 8:50 AM

Thank you so much, this was really helpful!

Posted by: ShRobbo at April 5, 2009 1:16 PM

Thank you very much man. I was getting annoyed with the silly default interpretation of HTML files by TextEdit.

Take it easy ;)

Posted by: Charrals at May 8, 2009 6:36 PM

thank you verymuch. this was a big help.

Posted by: name1 at May 13, 2009 10:16 AM

I'm just learning how to use a mac and this was SOOO helpful! THANK YOU!

Posted by: Diane at May 22, 2009 2:43 PM

This really helped. My Dad is making small html documents for us, when he couldn't edit them again after closing them, he got upset. This explained everything!

Posted by: Mac-User at June 24, 2009 1:59 PM

Lifesaver!

TexEdit was really pissing me off!!

I googled, I found this, and the problem was fixed!

Broker Jones

Posted by: Broker Jones at July 3, 2009 8:18 PM

Hi Dave,

Thanks for that info I was having a real lot of trouble, you have saved my day! Yeah.

Thanks Again
Melanie

Posted by: Melanie at July 14, 2009 4:52 AM

It is so great to have people like you out there that will help beginners like us. You saved the day!!

Thanks

Posted by: Linda at July 22, 2009 4:27 PM

I am writing an HTML document in text edit on my macbook pro and when I open up with my browser firefox (or safari) it is just displayed as the text not interpreted HTML
All the tags are still showing.

Posted by: Gail Ward at July 23, 2009 2:41 AM

Wow, thanks! This was so frustrating
Now I don't have to consider turning on my PC *shudder*

Posted by: Matthew Bender at August 19, 2009 12:58 PM

Dave - thanks for your step-by-step. I was getting increasingly frustrated and couldn't find what I was looking for until I came across your site. Thanks for making it easy :)

Paul

Posted by: Paul Norwine at August 21, 2009 12:04 PM

Hi,
I am trying to edit the html for my website to add keywords, title etc and don't know how to do it!
I have iweb 09 version 3....

Please help as I don't want to go back to my pc to do it!!!

Posted by: simon Phillips at October 2, 2009 3:31 PM

How i executing and running the PHP code in the mac o.s. Also i can't enable to execute the HTML code from above procedure. After that i used the the HTML file openwith in the Firefox browser then it worked.

Posted by: Rajendra Bhole at October 12, 2009 7:07 AM

I have the opposite problem. It only shows the HTML and not the formatted text when I open a new browser. I have checked and unchecked the Ignore rich text commands in HTML to see if there would be any difference. No change. Suggestions?

Posted by: Ann Lew at October 19, 2009 9:49 AM

THANK YOU
I resorted to using my husband's clunky IBM from 2000 to update my site, wish I'd discovered this about a year ago. :)

Posted by: Mimi at October 23, 2009 1:49 PM

Help I have a similar but slightly different problem to what you describe above. When I click on a simple html file on my desktop, it opens in Safari, which is what I want it to do, but displays like a textedit file, showing the htiml code instead of displaying as a regular we page.

Posted by: Mark Crawford at October 28, 2009 4:53 PM

thank you A LOT!!! i was getting mad!!! very clear and simple explanation! now after this thanking i go to read ALL your posts!

Posted by: mario isita at November 4, 2009 6:36 PM

Thanks, this helped a lot!

P.S. To all of you unable to view pages you make in browsers, I suffered this problem for a while as well. I figured out that you have to do a couple things to the code itself:
1. Declare a !DOCTYPE in the first line of the code. If you don't know what that is, Google it.
2. Put this line of code in your head:
meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
And if you are using CSS:
meta http-equiv="Content-Style-Type" content="text/css"
*I removed the >s and <s because they would not be displayed. You still have to put the brackets in your actual code.

Posted by: Annonymous at November 28, 2009 4:10 PM

thank you!!!!

Posted by: Michael Smith at December 19, 2009 1:48 PM

Extremely Helpful. Thank you

Posted by: Someone Learning Html at December 21, 2009 6:28 PM

I'm learning to create a web page using TextEdit on a mac. Essentially I pasted:


My big ole bad page!


Hello Joe!

and saved the file as HTML. The icon it opens in a browser (firefox or safari) just fine but all I get is the sam code back:


My big ole bad page!


Hello Joe!

and not

My big ole bad page

Hello Joe!


Help? and thanks in advance.

Posted by: Quinn Deveraux at January 6, 2010 3:05 PM

Thank you!!!!!!!!

Posted by: jenny at January 16, 2010 8:10 PM

You are my new demigod, as I learn to work with html, editing a site on my own computer for the first time instead of on the biz' setup. Thank you for your clear explanation!

Posted by: Tina at February 1, 2010 11:16 PM

Thanks Dave,

I'm just starting out and one goal is to change things in my website built by a friend a couple of years ago.

Your article really helped!

Best,
Jerry

Posted by: Jerry at February 24, 2010 12:30 PM

SHOOOOT MAN.
You are awesome! :)
Life saver. I was about to quit. Buuuut. Good
I saw this. Thankyou.
This helped me, BIGTIME.
:-bd

Posted by: Melissa Gonzales at February 24, 2010 8:12 PM

Thanks Dave!

It was handy advice that worked - just when I needed it.

Praveen

Posted by: Praveen Puri at March 12, 2010 9:27 AM

Thanks Dave! I also just migrated from PC to Mac and use HTMl! You saved me!

Posted by: Diana Kohne at April 14, 2010 9:48 PM

You have saved me so much time!!

Posted by: steve at May 20, 2010 5:14 PM

that was perfect! tks a lot!

Posted by: vferre at June 15, 2010 6:29 AM

Editing html in Mac OS X 10.6

While I can edit with TextEdit, I find also available is Dashcode. I like the colored/formatted etxt. Are there any pros/cons to use of Dashcode simply for editing (not making projects or widgets etc)? Thanks in advance!

Posted by: Zeke Zarnosky at June 23, 2010 11:15 AM

Zeke, I don't have much experience with Dashcode, but I can't imagine why it would be a problem!

Posted by: Dave Taylor at June 24, 2010 7:54 AM

Thank you for explaining this to us. It will be a great help for many years to come.

Posted by: Kevin Melanson at June 28, 2010 9:06 AM

Wow thanks! This is so helpful. :)

Posted by: Siti at July 16, 2010 5:31 AM

This is such a basic thing, but it was messing me up along with all of these other folks. And driving me nuts. Now I understand that rich text must use html tags as well. I thought maybe text editor was acting like a brower! So confusing. Thanks very much for posting this!!!!

Posted by: Dave at September 5, 2010 1:06 PM

WOW. Thanks.

Posted by: Johannes at September 7, 2010 12:14 PM

This doesn't fricking work. Mac OS is worthless for editing HTML.

Posted by: meerkat at September 8, 2010 5:56 AM

GREAT STEPS!! Worked for me! :)

Posted by: SAY at September 22, 2010 5:43 AM

Thank You!!!!

Posted by: adasd at October 4, 2010 9:58 AM

thanks this really helped me out!

Posted by: Steve at October 8, 2010 12:48 PM

WOW!!! This article was very helpful.

It was concise, clearly laid out, and addressed every last problem that one faces with using the mac text edit application.

Thank you!

Posted by: Anonymous at October 12, 2010 3:52 AM

this is really helpful thanks a lot

Posted by: Asad at October 17, 2010 7:21 AM

CHAMPION!

Posted by: Rami Tawil at October 19, 2010 4:48 AM

Thanks, Dave. This is a big help.

Posted by: Jonathan Rogers at October 22, 2010 9:52 AM

ORZ thanks a zillion

Posted by: jane at November 2, 2010 10:38 AM

hello..
i am not able to see the desired webpage on safari on double clicking the .html file.
it shows the same coding that is there in text edit.
please help me for the same.

Posted by: dhara at November 19, 2010 4:28 AM

THANK YOU sooooo much!
I was getting desperate trying to open an html file to get a code.
You have been of great help breaking it down step by step in a very visual manner. When you're a newbie in this internet world it's surprising the small things that get in your way.
Once again, thank you!

Posted by: Chantal Ouellette at November 22, 2010 1:18 PM

Thank you very much!
You're very helpful here... the problem made me upset, but now it's solved! Wish you good days!

Posted by: Lidya at December 4, 2010 4:28 PM

super duper tanx....solved ! im thrilled

Posted by: aman at December 31, 2010 3:01 AM

I have the same problem as the two posted questions below. I did not see an answer. Please help. I don't know why this is not working.

I am writing an HTML document in text edit on my macbook pro and when I open up with my browser firefox (or safari) it is just displayed as the text not interpreted HTML
All the tags are still showing.

Help I have a similar but slightly different problem to what you describe above. When I click on a simple html file on my desktop, it opens in Safari, which is what I want it to do, but displays like a textedit file, showing the htiml code instead of displaying as a regular we page.

Posted by: Jayne at February 1, 2011 10:18 AM

THANK YOU!! I never would have figured this out without tearing chunks out of my hair.

Posted by: J.C at February 6, 2011 7:07 PM

I followed all your steps & still get the web page displaying but in TextEdit, not the code. What else can I do?

Posted by: Enid Parry at February 8, 2011 8:59 AM

Worked great. Danke!
However... after changing a file, I opened the site in "iWeb". I published the entire site, looked at the coding and the changes were not saved.
1) i read about having to rename the site, exit the Safari browser and iWeb to then view any new changes. I have done used this process in the past, it works great.
2) on the other hand i attempted this process after changing coding in TextEdit but was not successful.

any suggestions?

V/R

Francis

Posted by: francis at February 16, 2011 12:40 PM

Hi, i wanna design my website with html codes and im using text edit, but when i open the html file with safari or firefox just displays the same as text edit file, what can i do to make the browsers open my html as a web site???

Posted by: Marco at February 25, 2011 9:53 AM

I am taking an html class, where we work on pc's using notepad. However, I work on a Mac at home. If I save my files in textedit as .htm will I be able to work with them on the pc in notepad when I go back to class?

Thanks, great help here!

Posted by: Kitty at March 17, 2011 11:23 AM

Thank you so much!! This post was a lifesaver.

Posted by: Taylor at March 18, 2011 11:49 AM

Thanks so much!!
i have wanted to know how to do this for such a long time!! i use snow leopard and the option is still there. thanks again!

Posted by: benjamin at March 21, 2011 2:20 PM

Thank you so much!!!!! God bless

Posted by: marie at April 3, 2011 7:46 PM

Dear Dave,
Thanks so much for this advice about text edit which is a life saver!
Like most of your viewers on this page I am new to a mac. Now that, thanks to you, I have worked out how to edit html text on textedit I am struggling to replace pictures. I select a pic in iphoto, click 'export' then 'web pg' then 'export'.. the pic appears in my web folder but not replacing the previous picture, it appears in a separate folder called 'images' and doesn't seem to relate at all to any of my original files, I can't see how to replace them. Please help!
Many thanks, Louise.

Posted by: Louise at April 14, 2011 6:25 AM

Worked perfectly for me! thanks for the tip.

Posted by: Emmanuel at April 15, 2011 8:25 AM

Ah, that was the trick I was hoping to find. Thou art thankt.

Posted by: Gabor at May 4, 2011 1:05 PM

thanks a lot, this helped out my whole class

Posted by: austin at May 24, 2011 8:05 AM

Thanks! This enabled me to re-open my textedit html files and see my code. It was still showing as code in my browser, though, like some other still-confused people said here. I saw in TextEdit, Preferences, that under New Document, I needed to change to "plain text". That worked for new files from then on. For one I'd created already, I could now see all this rich text "html" in there that looked ok to me but it was only when I deleted all that stuff that that file opened correctly in the browser.

Posted by: E.J. at May 27, 2011 10:13 AM

Dave, you're a legend! Your help was so clear and easy to understand. Thank you indeed sire.

Posted by: Richard at June 20, 2011 11:31 PM

Thanks ... you just saved my sanity.

Posted by: Matthew Guay at August 15, 2011 8:05 AM

Worked for me. Great!

Posted by: Hadi at August 17, 2011 10:51 AM

u r a star! thanks for the wonderful step by step guide!

Posted by: magz at August 19, 2011 10:02 PM

THANK YOU DAVE WORKS GREAT and I am personally astounded that Apple's default is to edit a html with Safari, which it cannot do!

Appreciate your work!
XXX
Mike

Posted by: Mike Lampton at September 11, 2011 6:25 PM

have the same prob as few others had it...when i open the html file in safari...entire code is displayed..i checked the suggested solution...declared the doc type and meta content as well in the html file code...however, it is still not opening in the web mode/formatted mode. Kindly help.

Posted by: naveen at September 13, 2011 8:27 AM

I am working with TextEdit in a MacBook Pro. OS 10.6.8. I change TextEdit default setting to Plain Text. I wrote the html and save it as .html but when I opened with Firefox or any browser the page opens in the browser window showing the exact html codes that I wrote.
For instance, I wrote a simple code to be displayed on a webpage

<html>

<head>
<title> EaseFilms Productions</title>
</head>


<body>
<h1> Pre-Production Approach </h1>
<p>
This is our best asset. The way we approach the Pre-Production phase of your film
will make the different at the time of Shooting, deal with the Post-Production, and
for Distribution.
</p>
<h4> Everything is in the details </h4>
<p>
Plan everything you will need for the production is our main goal. No time wasted.
</p>

</body>

</html>

I saved it as a .html. The default browser in my computer is set to work with Firefox, so I have now a document with the Firefox icon and the name I gave it. I double click this new document and Firefox browser opens but instead of showing the page with the Title, the body, etc. It shows the page identically as I wrote it.

Do you think you could help me to solve the problem?

I will appreciate any help.

By the way, it works fine when I use a PC and write the same .html.

Posted by: Gabo at September 20, 2011 7:43 PM

Great man ... tnx

Posted by: Hans at October 1, 2011 9:50 AM

Clear, Concise and Exactly what was needed. Thank you.

Posted by: Feidhlim Harty at October 5, 2011 1:10 AM

Thanks so much! This was a really big help!!

Posted by: Stacey at October 6, 2011 1:26 AM

Thanks for the help!

Posted by: Ian Robinson at October 20, 2011 10:27 PM

This was SOOOOO helpful!!!! It totally worked. :()

Posted by: et at December 10, 2011 5:30 PM

Thank you!
Textedit was driving me insane when trying to do simple tweaks when find tiny tiny tiny faults in my sites

(why did i never look in preferences?)

Posted by: max1zzz at December 19, 2011 11:57 AM

Thanks so much!! i thought i was going crazy trying to open my html... i'm new to mac, as you see ;)

Posted by: arrikitukis at December 26, 2011 9:01 PM

Thank you so much! I can stop pulling my hair out now. :)

Posted by: Eve at January 22, 2012 12:26 PM

Thanks this was very helpful -- just needed to click that option in the Text Edit prefs. Working just how i need it now - viewing complete HTML text without rich formatting.

Posted by: Allie at January 22, 2012 1:15 PM

I have something to say, now that you mention it, but ...
Starbucks coffee cup I do have a lot to say, and questions of my own for that matter, but first I'd like to say thank you for all your efforts on this Web site by buying you a cup of coffee!

I do have a comment, now that you mention it!











Remember personal info?


Please note that I will never send you any unsolicited email. Ever.

While I'm at it, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site.









Recent Entries


Search
I Need Help!
Need Help? Ask Dave Taylor!


© 2002 - 2012 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site.

[whiteboard marker tray]
"Ask Dave Taylor®" is a registered trademark of Intuitive Systems, LLC.