Wa vs Ha

From WagaWiki

Of all the Japanese kana は is one of the most confusing to new learners.

は is pronounced 'ha' in normal words. When は represents the particle は it is pronounced like 'wa' (i.e. the same as the kana わ). To reflect that difference in most (but not all) romaji systems は is written as 'wa' when it is the particle and 'ha' when it is not.

Note that several 'words' (more accurately customary idioms and phrases) include the particle は in them. In those cases they are pronounced with 'wa'.

こんにちは konnichiwa is one of those words that form the exception to the general rule. In recent times, particularly with young Japanese, it has come to be spelt as こんにちわ although that is technically a mistake.

Just to be confusing there is also a sentence ending particle わ (which is, of course, pronounced and spelt in romaji as 'wa').