It’s not always just about size, it also has to do with the number of islands and the actual coastline shape. For example, Japan is much smaller, but it have so many islands and such a rugged coast that it ranks above Australia. Norway is also the same, it’s not a big country by area but has so many islands and fjords that cause it to have a massive coastline when you put it all together. It’s also why Russia doesn’t rank that high, despite being the biggest country and having what seems like a massive coastline on its north and east. That said, measuring coastlines exactly is actually impossible, so rankings can vary quite a bit based on the approximations used