Copy and Paste
The easiest way I’ve found to do it (in small doses) is to copy and paste. I personally have a Word document call “pinyin tones” and that’s all that’s in it. Download it here if you want it too:
Pinyin Tones (6,904 hits)
Otherwise, if you have to do a whole lot of typing pinyin I suggest using a tool at www.xuezhongwen.net. After you get past the splash screen, click on “拼音 Type Pīnyīn” in the menu inside the left side-bar. You type “hao3” and you get “hǎo.” Very cool.
There is also apparently a tool called Wenlin that let’s you type pinyin with tone markings, but I’ve never used it (see Mark Swofford’s post about Wenlin).
Web Site Encoding
If you want to put pinyin on a website, and you want to be able to tweak the settings, use this tool by Mark Swofford. It will take “hao3” and convert it to “hǎo”. The only bad thing about it is it doesn’t remember your line breaks–but I’ve learned to cope.
MS Word Macro
(see comments below for other suggestions from readers)