Slime Farm Fundamentals
Slimes do not spawn on Peaceful difficulty. A chunk is a slime chunk when the seeded slime-chunk random gives zero out of ten.
Underground Slime Chunk Farms
In a slime chunk, a slime can spawn below Y 40, and only one in ten spawn attempts there passes the slime check.
Swamp Surface Farm Principles
Surface slimes spawn only in swamp and mangrove swamp biomes, between Y 51 and Y 69. The surface slime spawn chance follows the moon phase: 0.5 at full moon, 0.375, 0.25, 0.125, and 0 at new moon. A surface slime also needs the light level at its spot to be no higher than a random number from 0 to 7.
Monster Spawners
Slimes from a spawner skip the slime chunk and swamp rules and use the normal mob spawn rules.
Our companion Slime Finder and Biome Finder locate candidate coordinates and swamp biomes directly from your seed.
Sources
Read from the official 26.3 server jar (Slime.checkSlimeSpawnRules, data/minecraft/timeline/moon.json, biome tag allows_surface_slime_spawns).