A long, patterned snake slides along the edge of a California yard, and the first instinct for many people is to grab a shovel. Yet that snake is often a gopher snake, a nonvenomous predator that hunts rodents and other small animals.
It also puts on a convincing rattlesnake act when it feels threatened. Knowing how to react calmly can protect your family, your pets, and a helpful piece of local wildlife.
Gopher snakes eat rodents—and other prey

California gopher snakes are nonvenomous constrictors, and mammals are a big part of what they eat. They often search rodent burrows for prey, then squeeze it until it can no longer breathe.
National Park Service information notes that they are usually active by day, though they may be out at night during warm weather.
Mammals are not the whole menu. A large study of gopher snake diets found that mammals made up about 75 percent of the prey items recorded, but it also documented birds, eggs, and lizards.
What a snake eats varies with its size and where it lives, so it is not a specialist that goes only after gophers or mice.
That matters for your yard. A gopher snake is a rodent predator, and it may add a little natural pressure on the animals living nearby.
But that role is very different from a promise that one snake will keep your property rodent-free. A snake that passes through may take a mouse one week and a lizard or a nest of eggs the next.
So if you spot one, think of it as a visiting hunter that belongs to the local food web. It is not a pest-control service you can order, and it is not a pet.
Watching from a distance is the right way to enjoy it.
Their defensive display can resemble a rattlesnake’s

When a gopher snake feels cornered, it can put on a show. It may flatten its head, hiss loudly, and vibrate its tail.
Shaking that tail in dry leaves or grass can make a buzzing sound that easily reminds a startled person of a rattlesnake.
This bluff is a defense, and it can work on people just as it works on predators. UC Cooperative Extension reports that gopher snakes are often killed because of this resemblance.
The source does not give a count or a rate, so there is no way to say how often it happens across California.
Nobody needs to feel blamed for a jolt of alarm. Hearing a hiss and a buzz near your feet would rattle almost anyone.
The useful lesson is that a snake doing this display might be a harmless-looking neighbor or a real rattlesnake, and from a few feet away you cannot always tell.
That is why the safest response is the same in both cases: stop, step back, and keep kids and dogs away. Backing off costs you nothing, while getting close to a snake that is acting defensive is how bites happen.
No quick visual check guarantees a safe identification

Plenty of yard advice boils down to a single rule, such as a triangular head means rattlesnake or no rattle means gopher snake. Neither rule is reliable.
A gopher snake can flatten its head into a wider, triangular shape when it is upset, so head shape alone can fool you.
The rattle is no better as a shortcut. California’s vertebrate pest control handbook warns that rattles can break off.
Young rattlesnakes also carry only a small button instead of a developed rattle, so a quiet tail does not clear a snake.
A tapered tail without a rattle can be a clue, but it is only one clue. Reading it well means getting close enough to see the tail, the eyes, and the head, and that is exactly what you should not do.
Leaning in for a look puts your face and hands in bite range.
Instead, treat any snake you cannot confidently identify from a safe distance as potentially venomous. Call the dog inside, keep children back, and let the snake choose its own path.
Taking a photo with a zoom lens from far away is fine, but stepping closer for a better shot is not.
Give the snake room to leave

If a snake turns up in your yard, the best move is a quiet one. Keep people and pets well away, and give the animal space to move off on its own.
Most snakes want nothing to do with you and will leave once they have a clear path.
Do not try to catch, handle, relocate, or kill it. Any snake may bite if it is cornered or picked up, and California Department of Fish and Wildlife guidance says not to touch or handle snakes.
Shovels, brooms, and tongs all bring you closer than you should be.
Sometimes a snake will not leave. If it is by a door, in a garage, or somewhere it poses an immediate safety concern, call a qualified local wildlife or snake-removal professional.
UC IPM advises leaving nonvenomous snakes alone where possible and using professional removal when it is needed.
Please skip the repellent aisle and the folk remedies too. UC IPM says home remedies do not work, no plants are known to repel snakes, and commercial repellents are not proven enough to recommend.
Sulfur and mothballs will not move a snake, and they add chemicals to your garden.
Meanwhile, you can go about your day from a distance. Bring the dog in, wait ten or fifteen minutes, and check again from the window.
A gopher snake cannot guarantee a gopher-free yard

Gopher snakes are good at what they do, but a single snake cannot patrol a whole yard. It may eat a rodent now and then, and it may pass through in a day.
Whatever it catches, a snake does not stay put to watch over your flower beds.
Pocket gophers are a tougher problem than they look. They spend most of their time in tunnels, breed quickly, and can wreck roots, irrigation lines, and vegetable plots.
UC IPM cautions that natural predators may not reduce pocket gophers to the level you want.
The diet research points the same way. Since these snakes also take birds, eggs, and lizards, and since the study behind that finding did not measure yard rodent counts, you cannot count on them to clear a property.
If you see fresh mounds and ongoing damage, plan on direct pest-management measures. The UC IPM pocket gopher page walks through options such as trapping, so you can pick a method that fits your yard.
Leaving a gopher snake alone is still a fine choice, because it adds a small, free bit of natural pressure. Just do not skip the real fix while waiting for a snake to do the job.
Let a useful neighbor pass without handling it

A gopher snake is a nonvenomous rodent predator, not a pet and not a guaranteed pest-control fix. Distance is what protects people and pets, especially when the snake’s identity is uncertain.
UC IPM guidance supports leaving snakes alone where possible and calling a professional when a real safety concern comes up.
Looks alone should never be the reason a snake is killed. Step back, wait, and let it slip away into the brush like any other visitor passing through.