I assume you are talking about chickens, not turkeys, guineas, ducks, or something else. With chickens, sometimes it is a lot easier than other times. You don't always have to wait until they lay an egg to be sure though.
I assume you know about the sex link traits that can lead to sex linked chicks. The main ones are feather sexing, red sex links, and black sex links, but there are some other sex linked traits that can sometimes be used. For any of them, the parents have to be set up genetically for it to work. In spite of the videos and claims on this forum, feather sexing does not work with newly hatched chicks unless the parents have been genetically set up for it.
There are some autosexing breeds or traits if you are sure of the parents’ genetic purity. Not many but some. For example, with a chick where both parents are pure for barring like Barred Rocks, the spot on a male's head will be larger than the spot on a female's at hatch. But this is not always clear and the chick's down has to be a color that you can see the spot.
The younger they are, the harder they are. It would help to know what age you are looking at. Some chickens are a lot harder than others too, even when they are older. There are a lot of clues but sometimes it takes a while to really be sure. These are mostly clues. Often experienced people on this forum can't agree when we see photos of chickens two or three months old. The differences are not always real clear. Photos of the head showing comb and wattles help, but a good body shot showing saddle and hackle feathers and the legs are a great help.
One way to be sure for me are the hackle and saddle feathers. If these come in sharp and pointed, it is a cockerel. If they are rounded, it is a pullet. But you sometimes have to wait months to see the difference.
The comb and wattles can be a real good clue. A male's comb and wattles normally grow faster and turn red earlier than a pullet's. But this is a clue, not an absolute. You still have to wait several weeks and sometimes they will still fool you. I trust the wattles more than the comb.
As they grow they get different body configurations. They just look different. Males usually have heavier legs and a more upright posture. An experienced person can sometimes make a fair guess with day old chicks just based on posture, but this works a lot better if you are picking a few chicks from a bunch. There are a whole lot of chicks where this is not clear, even as they age.
Males tend to grow bigger than females. But this takes time to show up. At hatch, size depends on the size of the egg they came from and how many nutrients it had in it. After they grow a while, a size difference can show up. But you have to have chicks that are all the same breed and generally share the same genetics. Different breeds are different sizes. This will not work if you have mixed breeds.
There can be behavioral differences. Males tend to be more aggressive than females. But it is not at all unusual for pullets to join in the fights and such. That is just them settling the pecking order. Again, a clue but not a dead giveaway.
It's not always easy. I can usually be pretty sure around 4 to 5 weeks of age with many breeds if I see them live, but I have some Ameraucana based EE's at 7 weeks that are just becoming clear and I am still not sure on a few of them.
I'm sure I've forgotten a few possible ways. Good luck!