Controlling Your Search Snippet: data-nosnippet, max-snippet and nosnippet
Short answer: Google builds the text under your result from the page itself, or from the meta description when that fits the search better. You can restrict it in three ways: nosnippet removes text previews for the whole page, max-snippet:N caps the preview at N characters, and data-nosnippet excludes specific blocks inside the page. Most small business sites should change nothing. Use these controls only when part of a page, such as prices for members or a paid report, should not be quoted in results.
What a snippet is
The snippet is the grey text under the blue title in a search result. Google chooses it automatically from visible page text, aiming to show the passage that best matches the search. The meta description is a suggestion, not a guarantee; Google often replaces it with a passage it finds more relevant.
Other features draw on the same text: featured snippets, AI-assisted summaries and previews in some discovery surfaces. The controls here affect how text from your page is shown in Google's search results, and Google documents which of them apply to its own features, so read the current help page if you rely on this for rights or licensing reasons.
The three controls at a glance
| Control | Where it goes | What it does | When to use it |
|---|---|---|---|
nosnippet |
Robots meta tag or X-Robots-Tag header | No text snippet or video preview for the page | The page is a paid report or gated article and you want no excerpt |
max-snippet:N |
Robots meta tag or header | Limits the excerpt to N characters; 0 means none, -1 means no limit |
You want some preview but not the whole opening section |
data-nosnippet |
HTML attribute on span, div or section |
Hides only that block from snippets | A price, phone line, spoiler or member-only teaser inside an otherwise public page |
How to write each one
Page level
In the head of the page:
<meta name="robots" content="nosnippet">
or
<meta name="robots" content="max-snippet:160">
For files without a head, such as PDFs, send an X-Robots-Tag: max-snippet:160 header from the server. You can combine directives, for example max-snippet:160, max-image-preview:large.
Block level
Wrap the text you want excluded:
<p>Call for a quote.
<span data-nosnippet>Members price: 45 per month</span></p>
Rules worth knowing: the attribute is valid on span, div and section elements, the HTML must be well formed with the tag closed properly, and content added by JavaScript is picked up only if it exists after rendering. Keep the marked block short and self-contained.
Common situations
- A price list behind a "from" price. A shop wants searchers to visit rather than read every tier in the result. Mark the detailed tier block with
data-nosnippetand leave the headline text visible. - A gated article. A trade journal shows the first paragraph free.
max-snippet:200limits the quote while still giving searchers a hook. Where paid content is shown to Googlebot in full, publishers should also look at Google's guidance for paywalled content so the setup is not mistaken for cloaking. - Event or class pages with spoilers. A mystery experience business might hide the solution notes with
data-nosnippet. - A cookie or consent line that keeps appearing as the snippet. The better fix is making the main text stronger and the banner less prominent in the markup, rather than hiding the banner text. Use
data-nosnippeton the banner container if it has become the preview. - Legal or regulated copy. If a disclaimer must not appear out of context, mark it, though the safer path is placing it near the claim it qualifies.
What these controls do not do
- They do not stop Google indexing the page. For that you need
noindex. - They do not stop other sites copying your text.
- They are not a security measure; the text remains visible on the page.
- They can reduce clicks. A result with no description is less informative, so a very low limit often makes the listing look unfinished. Test the effect before applying it widely.
- Google may not honour every combination in every surface, so confirm in the documentation for the feature you care about.
How to check
- Add the control and publish.
- Use the URL Inspection tool, run a live test and confirm the rendered HTML contains your attribute or meta tag.
- Wait for a recrawl, then search for a phrase from the page and see what appears.
- If the snippet is not changing, check that nothing else, such as an SEO plugin, writes a conflicting robots tag.
Better first: improving what Google shows
If your complaint is that the snippet reads poorly, adjusting it is often easier than restricting it. Write a meta description that matches the page, start sections with a clear sentence that answers the main question, and make sure the first visible text is not a menu or banner. A good opening paragraph often becomes the snippet by itself.
FAQ
Does nosnippet hurt my ranking?
It does not change how the page ranks, but it can lower click-through because the result has less to offer.
Can I use data-nosnippet on an image caption?
Yes, if the caption sits in a supported element. It affects text excerpts, not the image itself, which has its own controls such as max-image-preview.
Is the meta description affected?
nosnippet and max-snippet limit the text excerpt, which includes using your meta description as that excerpt.
How long before a change shows?
It takes effect when Google next recrawls the page, which can be days to weeks.
If you want help deciding what your pages should and should not show in search, contact us through our enquiry page.