Planet formation theories predict that some planets may be ejected from their parent systems as result of dynamical interactions and other processes. Unbound planets can also be formed through gravitational collapse, in a way similar to that in which stars form. A handful of free-floating planetary-mass objects have been discovered by infrared surveys of young stellar clusters and star-forming regions as well as wide-field surveys, but these studies are incomplete for objects below five Jupiter masses. Gravitational microlensing is the only method capable of exploring the entire population of free-floating planets down to Mars-mass objects, because the microlensing signal does not depend on the brightness of the lensing object. A characteristic timescale of microlensing events depends on the mass of the lens: the less massive the lens, the shorter the microlensing event. A previous analysis of 474 microlensing events found an excess of ten very short events (1-2 days)—more than known stellar populations would suggest—indicating the existence of a large population of unbound or wide-orbit Jupiter-mass planets (reported to be almost twice as common as main-sequence stars). These results, however, do not match predictions of planet-formation theories and surveys of young clusters. Here we analyse a sample of microlensing events six times larger than that of ref. 11 discovered during the years 2010-15. Although our survey has very high sensitivity (detection efficiency) to short-timescale (1-2 days) microlensing events, we found no excess of events with timescales in this range, with a 95 per cent upper limit on the frequency of Jupiter-mass free-floating or wide-orbit planets of 0.25 planets per main-sequence star. We detected a few possible ultrashort-timescale events (with timescales of less than half a day), which may indicate the existence of Earth-mass and super-Earth-mass free-floating planets, as predicted by planet-formation theories.