Problem with html coding Mac

I have a 12 inch MacBook and this is my first time to write HTML code on mac. I thought html coding mac is as easy as writing HTML code using a regular notepad application. I used this TextEdit application in Mac to write my code, but my problem is that, I could not find a way to save this file into HTML format.
I can save it in .rtf format just fine, but what I need is to save it in HTML format so I can view it in a webpage locally. Do I need to install an HTML editor application or is there any built in HTML editor for Mac users?
