Close Menu
  • Home
  • Roof & Gutters
  • Exterior Cleaning
  • Decks & Patios
  • Concrete & Pavers
  • Drainage & Yard
  • Seasonal Care
  • Tools
Facebook
Facebook Pinterest
Home Exterior Lab
  • Home
  • Roof & Gutters
  • Exterior Cleaning
  • Decks & Patios
  • Concrete & Pavers
  • Drainage & Yard
  • Seasonal Care
  • Tools
Home Exterior Lab
Home » Decks, Fences & Patios » Garden Fences
Decks, Fences & Patios

Garden Fences

Home Exterior LabBy Home Exterior LabNovember 21, 2026Updated:November 28, 2026No Comments24 Mins Read
Share Facebook Twitter Pinterest Threads Bluesky LinkedIn Tumblr Email
Red and yellow tulips blooming in front of a white picket garden fence
Photo by Kristina Paukshtite on Pexels
Share
Facebook Twitter Pinterest Threads Email Copy Link

Last updated: November 28, 2026

A garden fence is a barrier built around or inside a garden to mark its edge, keep people and animals where they belong, and give the planting beds a finished frame. It can be as simple as a knee-high picket border around a flower bed or as serious as an eight-foot wire fence holding deer out of a vegetable patch. The right one depends on the job you need it to do, and that job should decide everything else: the height, the material, and how much you spend.

Most garden fences fail for the same reason. The owner picked the look first and the purpose second. A pretty picket fence will not stop a rabbit. A solid privacy panel will shade the very bed it was meant to protect. Get the purpose right and the rest of the choices get easy.

Contents

  • What Is a Garden Fence, Exactly?
  • Start With the Job, Not the Look
  • Garden Fence Types That Work in a Garden
  • Garden Fence Materials, Compared Honestly
  • How Tall Should a Garden Fence Be?
  • How to Choose a Garden Fence in 7 Steps
  • What Garden Fences Cost
  • Keeping a Garden Fence in Good Shape
  • Five Mistakes That Shorten a Garden Fence’s Life
  • DIY or Hire a Pro?
  • Garden Fences: FAQs
  • Sources

What Is a Garden Fence, Exactly?

A garden fence is a fence whose main job is tied to the garden itself: it encloses a planting area, marks a garden boundary, keeps animals out of beds, or gives climbing plants something to grow on. That sounds obvious, but the distinction matters. A boundary fence around a whole property answers to the property line, the neighbors, and the local code. A garden fence answers to the plants.

Garden fences come in two broad shapes. A perimeter garden fence wraps the whole garden or the whole yard, and it behaves a lot like any other yard fence. An inner garden fence sits inside the yard and rings just the beds, the vegetable patch, or the cutting garden. Inner fences can be lower, lighter, and cheaper, because they only have to stop feet, paws, and nibbling animals, not mark a legal boundary or screen the neighbors.

The other thing that sets garden fences apart is how much they have to live with plants. Vines climb them, shrubs press against them, soil and mulch pile up at their base, and sprinklers soak them daily. A fence that looks fine on a bare lot can rot fast once a garden grows up around it. So the material and the way the bottom of the fence meets the ground matter more here than they do for a fence standing alone on a lawn.

Start With the Job, Not the Look

Before you look at a single style, write down what the fence has to do. One clear job beats a long wish list, and most gardens only need a fence to do one or two things well.

What you needThe fence that fitsTypical height
Mark the edge of beds and keep feet off plantingsLow picket, small rail, or short decorative panels18 inches to 3 feet
Keep a small dog in the garden areaPicket or wire mesh with narrow gaps, no climbable rails on the outside3 to 4 feet
Screen a seating spot from the street or neighborsSolid wood or vinyl panels, sometimes with a lattice topper6 feet
Keep rabbits out of vegetablesWelded wire or hardware cloth with the bottom buried a few inches and bent outward2 to 3 feet
Keep deer out of a vegetable gardenTall woven wire, solid panels, or slanted wire (see the height section below)8 feet
Give roses, beans, or vines something to climbLattice, open slats, or wire mesh on a simple frame4 to 6 feet
Mark a boundary that looks good from the housePicket, ornamental metal, or horizontal slats3 to 4 feet

A fence can do two jobs at once if the jobs agree. A four-foot picket fence marks a boundary and keeps a small dog in. A six-foot solid fence gives privacy and blocks wind. But a fence asked to do two jobs that fight each other, like screening the neighbors and letting full sun reach the tomatoes, will do neither well. When two jobs clash, pick the one that matters most and let the other go, or split the garden and fence each part for its own job.

Think about the sun, too. A solid fence on the south side of a vegetable bed will throw shade across it for part of the day. In a cool climate that shade costs you growth. In a hot climate it may be a blessing for lettuce and other plants that bolt in the heat. Walk the garden at midday before you decide.

Garden Fence Types That Work in a Garden

Garden fencing comes in a handful of shapes that keep showing up because they work. Each one suits a different job, and each one has a weakness worth knowing before you buy.

Picket fences are the classic garden border: short vertical boards with gaps between them, usually in wood or vinyl. They mark an edge, look friendly, and let light and air through, which plants like. They will not stop a rabbit or a determined dog, and they give no privacy. If your main goal is a neat edge around flower beds, a picket fence is hard to beat.

Panel fences are solid boards set edge to edge, most often in wood or vinyl. They give real privacy, cut wind, and block the view into the garden. The trade-off is shade and wind load. A solid panel catches the wind like a sail, so the posts have to be set well, and the shaded strip along its base stays damp longer, which is where rot starts on a wood fence. Keep soil and mulch pulled back from the bottom boards.

Lattice and trellis fences are open grids that climbing plants love. Roses, clematis, beans, and peas will cover a lattice panel in a season or two, and the fence turns into a living wall. Lattice alone stops almost nothing, so pair it with wire mesh behind it if rabbits or dogs are the problem. It works best as an inner fence or as a topper on a solid panel, where it adds height and a place for vines without blocking the view completely.

Wire and mesh fences are the workhorses of the vegetable garden. Welded wire, woven wire, and hardware cloth are cheap, nearly invisible from a distance, and easy to shape around odd corners. They do the unglamorous jobs: keeping rabbits out, ringing a single prized shrub, or holding deer back at full height. They are not much to look at on their own, so many gardeners plant a hedge or a row of flowers in front of them and let the plants do the decorating.

Ornamental metal fences use slim vertical bars, most often aluminum or steel, with decorative tops. They mark a boundary without hiding the garden, they need little upkeep, and they last a long time. They cost more than wood or wire up front, and the gaps between bars will not stop a small animal. If you like the look and the low upkeep, our guide to aluminum fences covers the styles, grades, and pool-code rules in detail.

Split rail fences are two or three horizontal rails slotted between posts, with wide open gaps. They suit a country-style garden and mark a boundary with almost no visual weight. They stop nothing smaller than a person, so they work as a marker or as a frame for a wire mesh backing. Add mesh and a split rail becomes a real animal fence that still looks rustic.

Living fences are hedges and densely planted shrubs used as a fence. They take years to fill in and need regular trimming, and they will not keep a rabbit out on their own. What they give back is softness and habitat: birds nest in them and pollinators visit them. A living fence pairs well with a short wire fence hidden inside it while the shrubs grow.

Rustic wooden garden fence with pink flowers growing along its base in a cottage garden
Photo by Halil Can on Pexels

Garden Fence Materials, Compared Honestly

Material is where most garden fences are won or lost. The wrong material in the wrong spot will rot, rust, or sag, and no amount of stain will save it. The right material is the one that matches your climate, your upkeep habits, and the job from the table above.

MaterialLook and feelUpkeepBest forWatch out for
Wood (cedar, redwood, pressure-treated pine)Warm, natural, easy to shape and paintStain or seal every few years, watch the base for rotMost garden jobs, any styleRots where soil, mulch, or sprinklers stay against it
VinylClean, smooth, holds its colorWash now and then, almost nothing elsePrivacy panels, low-maintenance gardensCan crack in hard freezes, looks less natural up close
AluminumSlim bars, classic iron look without the weightRinse off dirt, check fastenersBoundaries, front gardens, pool areasGaps stop no small animal, costs more than wood
SteelStrong, heavier, can be ornatePaint or coating needs care to stop rustSecurity, tall fences, gatesRust if the coating fails, heavy to install
Wire mesh (welded or woven)Nearly invisible, purely practicalCheck for rust and sagging, tighten as neededVegetable gardens, deer and rabbit exclusionLooks bare without plants in front of it
Bamboo and willowNatural, light, informalShorter life, replace sections as they ageScreening, rustic beds, temporary bordersBreaks down fast in wet soil, not a security fence
CompositeLooks like wood, resists rot and insectsWash now and thenDamp spots, low-upkeep gardensCosts more, heavy, limited styles

Wood is still the default for garden fences, and for good reason. Cedar and redwood resist rot and insects on their own, while pressure-treated pine costs less and holds up well when it is kept dry at the base. But wood also asks the most of you. A fence that never gets sealed will go gray, and one that sits in wet soil will rot from the bottom up. Our guide to how long wood fences last walks through what to expect from each type of wood and what actually shortens its life.

Vinyl and composite win on upkeep and lose on warmth. If you hate painting and sealing, they are the honest choice. Just know that a vinyl panel in a garden still needs a wash now and then, because algae and dirt show up fast on a white surface, and a green film on a fence is the first thing visitors notice. That green film is usually harmless, but if it bothers you, our guide to a wood fence turning green explains what causes it and how to clean it off.

Metal fences, mostly aluminum these days, are the set-and-forget option. They do not rot, they do not need paint, and they hold their shape for decades. Their weakness is the gaps. A rabbit walks straight through most ornamental metal fences, so they suit a front garden or a boundary marker far better than a vegetable patch.

Bamboo and willow look wonderful for a season or two, and they fit a cottage garden like nothing else. Treat them as a short-life choice. In wet soil they break down fast, and a willow hurdle that looked charming in spring can be falling apart by the second winter. Use them where you can replace them easily, not where a failure lets deer into the beans.

How Tall Should a Garden Fence Be?

Height is the question most people get wrong, and the answer is almost always “lower than you think, except when it is higher.” A fence that is too tall shades the beds, blocks the breeze, and may break a local rule. A fence that is too short wastes your money, because it does not stop the animal it was built for.

Height follows the job. A border around flower beds only needs to be knee-high. A privacy screen needs to be tall enough to block a standing person’s view, which is usually six feet. A deer fence needs to be eight feet, because deer can jump that high.

PurposeHeight that worksNotes
Edge a flower bed, keep feet off plants18 inches to 2 feetLow enough to step over, high enough to see
Keep a small dog in3 to 4 feetAdd mesh if the gaps are wide
Keep rabbits out2 to 3 feet, with mesh buried a few inchesRabbits dig, so the bottom matters as much as the height
Privacy for a seating area6 feetCheck local rules first, many places cap backyard fences at 6 feet
Keep deer out8 feetThe reliable number, see below
Screen a compost heap or bins4 to 6 feetSolid panels hide the mess and block wind-blown litter

The deer number deserves a closer look, because it surprises people. Iowa State University Extension states plainly that a passive deer fence must be at least 8 feet tall to stop deer leaping over it, and it has to reach all the way to the ground so deer cannot duck under it. Woven wire is the material they call most common and reliable for the job. That eight-foot height can clash with local rules, and many towns cap backyard fences at six feet, so check before you build. If eight feet is not allowed, there are two workarounds worth knowing. A six-foot solid privacy fence can still work, because deer will not jump when they cannot see where they would land on the other side. And a small garden under about ten feet square, ringed with a six-foot fence, is rarely jumped either, because there is not enough room for a deer to land inside.

Height rules are local, and they vary more than people expect. Front-yard fences are often capped lower than backyard fences, corner lots have sight-triangle rules so drivers can see around the corner, and some towns require a permit above a certain height. Homeowners associations add another layer, and they can be stricter than the town. Our guide to privacy fence height walks through the common caps and how to check yours. A quick call to the local building office before you buy materials is cheaper than rebuilding a fence that is two feet too tall.

How to Choose a Garden Fence in 7 Steps

Choosing a garden fence goes better as a sequence than as a shopping trip. Walk through these steps in order and you will end up with a fence that fits the garden instead of fighting it.

  1. Name the job. Pick one main job from the purpose table above. Write it down. If two jobs matter, rank them. This one line will settle most later arguments about height and material.
  2. Walk the garden at midday. Stand where the fence will go and look at the sun, the slope, and the plants. Note which beds would fall into shade behind a solid panel, and where water pools after rain. A fence across a low spot will sit in wet soil, and wet soil is what rots wood posts.
  3. Measure and mark the line. Measure the run, count the corners and gates, and mark the line with string and stakes. Walk it twice. Moving a string line costs nothing; moving a finished fence costs plenty.
  4. Check the rules before you dig. Confirm the property line, ask the building office about height caps and permits, and read the HOA rules if you have them. Tell the neighbors what you plan, especially if the fence sits on a shared line. A fence that surprises a neighbor becomes a dispute, and disputes outlast fences.
  5. Call 811 before any digging. Dial 811 a few business days before you plan to dig, and the local utilities will mark their buried lines for free. The service covers electric, gas, water, sewer, and communication lines, and it applies to fence posts just as much as to big excavation jobs. One catch: the free locate usually does not cover private lines, like sprinkler pipes, a septic line, or the wire for an invisible pet fence, so walk the yard and think about what else might be buried. Northern Lights, Inc. notes that 811 marks are free and that you should wait for every utility on your ticket to respond before you start digging.
  6. Set the posts right. A garden fence stands or falls on its posts, and the posts are the part nobody sees. QUIKRETE’s post-setting guide gives the rule most builders use: dig each hole about three times as wide as the post, and make the depth one-third to one-half of the post’s above-ground length, plus six inches. Put six inches of gravel in the bottom so water drains away from the end of the post, set the post plumb, and fill with concrete to a few inches below ground level. In cold country the other rule takes over: the bottom of the post has to sit below the frost line, or the freezing ground will lift it a little each winter and the fence will lean. Your building office can tell you the frost depth for your address. The sketch below shows the parts in one view.
  7. Pick the material last. With the job, the height, and the post plan settled, the material choice almost makes itself. A low border around flower beds wants wood or vinyl pickets. A deer fence wants woven wire. A privacy screen wants solid panels. Buy a little extra for cuts and mistakes, and keep a few spare boards in the shed.
Hand-sketched cross-section diagram of a garden fence post showing the fence board, rail, post, ground level, concrete footing, gravel drainage layer, and frost line

Illustration: Home Exterior Lab

What Garden Fences Cost

Cost is the question every garden fence guide has to answer carefully, because a single number would be wrong for most readers. The price of a garden fence moves with its length, its height, its material, the slope of the ground, the number of gates, and whether you hire the work out. A short low border around two beds and a tall privacy fence around a whole yard are different projects that happen to share the word fence.

The drivers are consistent, though. Length is the biggest one, since every extra foot adds posts, panels, and concrete. Height comes next, because a taller fence needs longer posts, deeper holes, and more material per foot. Material sets the range: wire mesh and simple wood sit at the thrifty end, vinyl and composite higher, ornamental metal higher still. Sloped ground adds labor, because each section has to step or rack to follow the grade. Gates cost more than plain fence per foot, since they need heavier posts and hardware. And an old fence that has to come out first adds removal and disposal to the bill.

If you want real numbers for your area, our fence cost guide breaks down the drivers and the ranges in detail. Read it before you get quotes, so you know which line items to question. Get at least two quotes if you hire the job out; the spread is usually wider than people expect.

Keeping a Garden Fence in Good Shape

A garden fence lives a harder life than a fence on an open lawn. Soil piles against it, mulch holds moisture at its base, sprinklers soak it, and vines pull at it. A little regular care goes a long way, and most of it takes an afternoon a year.

Walk the line each spring and look at the base of every post and panel. Soil and mulch should sit a couple of inches below the bottom board, not piled against it. Pull back anything that touches the wood and trim any shrub that presses on the fence. Look for leaning posts, loose rails, and boards that have gone soft at the bottom. A soft spot at the base of a post is the early warning, and catching it early is the difference between replacing one post and replacing a whole run.

Wash the fence once a year. A hose and a soft brush take off most dirt and algae. If the green film keeps coming back, our fence cleaning guide covers the safe way to clean each material without damaging it. Wood fences need a fresh coat of stain or sealant every few years, and the schedule depends on your climate and how much sun the fence gets. A fence that faces south in a hot climate will need it sooner than a shaded one.

Check the fence after big storms. Wind and heavy rain find the weak posts, and a post that leans a little after a storm will lean a lot more after the next one. Tighten loose fasteners, reset any post that has shifted, and replace a cracked board before it takes the next one with it. Fences are forgiving when they are caught early and expensive when they are not.

Five Mistakes That Shorten a Garden Fence’s Life

Burying the bottom board. Soil, mulch, or compost piled against the bottom of a wood fence holds moisture there all year. The boards rot from the bottom up, and the fence looks fine until the day it does not. Keep a couple of inches of clear space along the base.

Skipping the 811 call. A post-hole auger through a buried electric or gas line is the kind of mistake that ends a project in an ambulance or a repair bill. The locate is free. There is no good reason to skip it.

Setting posts too shallow. A post buried a foot deep will stand fine on a calm day and lean after the first wet winter. The depth rule from the steps above exists because wind and frost are patient. Give the posts the depth they need and the fence will stay straight for years.

Building over the property line. A fence a foot over the line is a dispute waiting to happen, and moving it later costs far more than a survey costs now. If the line is not obvious, get it marked before you dig.

Planting climbers and forgetting them. A rose or a vine on a fence is lovely, and it is also heavy and wet. Left alone, a climber will pull boards loose, hold moisture against the wood, and hide rot until the fence fails. Train climbers on wires a few inches off the fence so air can move behind them, and prune them back every year.

DIY or Hire a Pro?

A low garden fence on flat ground is a very doable weekend project for a careful DIYer. Short picket borders, wire mesh around a vegetable patch, and simple panel runs on level ground all sit well within DIY range, provided you call 811, check the rules, and set the posts properly. Rent an auger for a day and bring a second pair of hands; the panels go up straighter that way.

Hire a pro when the fence is tall, the ground slopes, the line runs near a property boundary, or the job includes gates. Gates are the hardest part of any fence, because they sag, bind, and need heavier posts than the rest of the run. A pro is also the right call when the fence needs a permit, when the soil is rocky or full of roots, or when an old fence has to come out first. If your fence project involves a pool, check the pool-code rules before anything else. Our guide to aluminum fences covers the common pool-barrier requirements, and they are stricter than most people expect.

A fence also touches your home insurance in ways people forget. Some policies ask about fences, and a fence that is poorly built or that blocks a required exit can matter at claim time. Our guide to home insurance and fences explains what insurers usually ask and what to check in your own policy.

Garden Fences: FAQs

How tall should a garden fence be?

It depends on the job. A border around flower beds only needs 18 inches to 2 feet. A privacy screen needs about 6 feet. A fence meant to keep deer out needs to be 8 feet tall, which is the height Iowa State University Extension gives for a reliable deer barrier. Check local rules before you build, since many towns cap backyard fences at 6 feet.

What is the cheapest garden fence?

Simple wire mesh and basic wood panels tend to cost least up front, especially for a vegetable garden where looks matter less than function. A low picket border around beds is also thrifty, since it uses short boards and shallow posts. The cheapest fence to buy is not always the cheapest to own, though. A fence that rots in five years costs more than one that lasts twenty. Our fence cost guide breaks down the drivers so you can compare honestly.

Do I need a permit for a garden fence?

Sometimes. Many towns require a permit above a certain height, often 6 feet, and some require one for any fence on a property line or in a front yard. Corner lots have extra sight rules. A quick call to the local building office will settle it, and it is far cheaper than rebuilding a fence that breaks a rule.

How deep should garden fence posts go?

Use the deeper of two rules. QUIKRETE’s post-setting guide says to dig the hole one-third to one-half of the post’s above-ground length, plus six inches for a gravel base. In cold country, the bottom of the post also has to sit below the local frost line, or the ground will lift it a little each winter. Your building office can give you the frost depth for your address.

What fence keeps deer out of a garden?

A fence at least 8 feet tall, reaching all the way to the ground, is the reliable answer. Iowa State University Extension calls woven wire the most common and reliable material for it. A 6-foot solid fence can work for a small garden, because deer will not jump when they cannot see where they would land, but it is not as certain as the full eight feet.

How long does a garden fence last?

It depends on the material and the upkeep. Wood fences last longest when they are kept dry at the base and resealed on schedule, and shortest when soil and sprinklers sit against them. Vinyl and metal fences generally outlast wood with less care. Our guide to how long wood fences last gives the numbers for each type of wood and what shortens them.

Can I put a garden fence on the property line?

Often yes, but the rules are local, and a fence on the line is a shared matter with the neighbor. Some towns require the fence to sit a few inches inside your own side. Confirm the line with a survey if it is not clear, talk to the neighbor before you build, and check the local code and any HOA rules. A fence a foot over the line can turn into a costly dispute.

Sources

  • Iowa State University Extension: How to Protect Gardens from Deer, covering the 8-foot minimum for a passive deer fence, woven wire as the most common and reliable material, and why a 6-foot solid fence can still work for a small garden.
  • Northern Lights, Inc.: Call 811 Before You Dig, covering the free locate service for fence posts and other digging, the five steps to safer digging, and the private lines the free locate does not cover.
  • QUIKRETE: Setting Posts in Concrete, covering hole width and depth, the 6-inch gravel base, and fast-setting concrete for fence posts.
Share. Facebook Twitter Pinterest Threads LinkedIn Tumblr Email
Previous ArticleAluminum Fences: Styles, Grades, Pros and Cons, and Pool-Code Basics
Next Article Temporary fences
Home Exterior Lab
  • Website

Home Exterior Lab is a small editorial team that writes research-backed guides to looking after the outside of a house: gutters, roofs, siding, decks, fences, patios, driveways, and drainage. Every guide is written from published, authoritative sources that we open and read ourselves, and every figure is checked against more than one of them before it goes on the page.We started this site because exterior home care is full of confident answers that disagree with each other. One cost guide says $119, another says $275, and both sound sure. Our job is to open those guides, work out why they differ, and give the reader a number they can actually use, with the working shown.What we do: research each topic from the live search results and the authoritative sources behind them (university extensions, trade bodies, and manufacturers); compare prices across several national cost guides and explain the spread, instead of quoting one number; work out the maths in the open (per-foot rates, patio areas, paver counts, fence budgets); show our work — every factual claim links to its source, and the Sources section of each article lists only what we actually used.What we do not claim: we are not licensed contractors, roofers, or builders, and none of us claims to be; we do not run hands-on product tests, and we do not publish survey results, because we do not run surveys; we do not present stock photos as our own work — diagrams on this site are drawn by us, photos are credited to their photographers by name; when a job needs a qualified professional, we say so in the guide.How our guides are researched: our full method is on the How We Research page.Contact: questions, topic suggestions, or corrections — homeexteriorlab@gmail.com. For corrections, use the subject line "Editorial Correction" and tell us the article and the statement. Partnership and contributor enquiries start on the Contact page.Meet the editorial team behind the guides on our Our Authors page.

Related Posts

Ideas for Patios: 15 Small and Budget Layouts That Feel Finished

November 29, 2026

Types of Fences and Cost: Which Type Fits Your Yard

November 28, 2026

Wood Fences: Species, Treatment, and Care

November 28, 2026
Add A Comment
Leave A Reply Cancel Reply

Find a guide
Explore exterior topics
  • Roof & Gutters
  • Exterior Cleaning
  • Decks & Patios
  • Concrete & Pavers
  • Drainage & Yard
  • Seasonal Care
Practical guidance. Clear sources.

Home Exterior Lab helps homeowners understand exterior maintenance, compare their options and plan their next steps.

How we approach our guides →


Work in home exteriors?

For editorial enquiries and relevant business collaborations, visit our partnership page.

Work With Us →

Home Exterior Lab

Research-Based Guides for Smarter Exterior Home Care.

Clear, practical explanations for homeowners, property owners and landlords—from the roof above you to the yard around you.

Meet Home Exterior Lab →

Explore exterior topics
  • Roof & Gutters
  • Exterior Cleaning
  • Decks & Patios
  • Concrete & Pavers
  • Drainage & Yard
  • Seasonal Care
The publication
  • About Us
  • Our Authors
  • Editorial Policy
  • Contact Us
  • Work With Us
  • Contributor Guidelines

Useful guidance. Clear sources. Thoughtful partnerships.

Free calculators
  • All free calculators
  • Fence Cost Calculator
  • Paver Patio Cost Calculator
  • Gutter Size Calculator
  • Paint Coverage Calculator
  • About Us
  • Contact Us
  • Editorial Policy
  • Privacy Policy
  • Disclaimer
  • Work With Us
  • Write for Us
© 2026 Home Exterior Lab. Research-Based Guides for Smarter Exterior Home Care.

Type above and press Enter to search. Press Esc to cancel.