Inlays are more like fillings and are used to fill a hole or cavity in the tooth, the key difference being that inlays extend to the top edges of the tooth. Inlays are often used in situations where a filling has failed, and the tooth needs repair.
Onlays are designed to be used in a similar way to a crown and fit over the cusp of the tooth like a cap. An onlay requires less of the healthy parts of the tooth to be removed compared to a crown, with just some reduction to the tooth to allow the onlay to fit within the bite of the tooth.