Measuring geometry in OSM

How to measure length or area of a line /polygon in OSM ID and JOSM?

There is the measurement plugin for JOSM.

https://wiki.openstreetmap.org/wiki/JOSM/Plugins/measurement

Install using the plugins tab.