Is earnest money required?
Usually not by law, but almost always in practice. A home purchase contract can be valid without a deposit, yet most sellers expect one and many will pass on an offer that has none. Whether you must pay it, and how much, comes down to what your contract says.
Once you sign a contract that calls for earnest money, paying it on time becomes one of your obligations. Missing the deadline can give the seller grounds to cancel or claim you are in default.
Customs differ by state and by market. Some areas use a percentage of the price, others a flat amount, and builders often set their own deposit rules. Your agent can tell you what is normal locally. The guide on how much earnest money to put down explains what moves the amount up or down.