Generate Open Graph tags for social sharing
This Open Graph tags generator turns four essential social sharing fields into a clean HTML block for your page head.
Run — free
Runs in your browser. Free, unlimited — your data never leaves this page.
Supply a title, description, image URL, and object type, and it returns both complete markup and individual tag lines. The generator validates that the image uses HTTP or HTTPS, trims surrounding whitespace, and safely escapes characters that could break an HTML attribute. The output is deterministic, ready for templates and publishing systems, and available through the API for $0.002 per request.
Choose content that describes the shared page
Start with the page itself rather than the social network where it may appear. The Open Graph title should identify the specific article, product, profile, or landing page, while the description should give a reader a concrete reason to open it. Keep both accurate and self-contained because a shared link may appear without the surrounding context of your website. This generator requires non-empty values and removes whitespace at their outer edges, but it does not rewrite, shorten, or invent marketing copy. That keeps editorial control with you and makes the result predictable in automated publishing workflows. Although the accepted limits leave room for different platform practices, concise copy is usually easier to scan and less likely to be clipped by a card layout. Avoid placing essential meaning only at the end of a long description. Also remember that Open Graph metadata complements the visible page; it should not promise content that the destination does not provide. Consistency between the card and page helps readers understand where a link will lead.
Provide a public web image and the right object type
The image URL must be an absolute address using the http or https scheme. Relative paths, local file paths, data URLs, FTP addresses, and malformed URLs are rejected because social crawlers need a web-reachable resource. This check confirms the address format and protocol only: the generator does not download the image, test its dimensions, inspect its media type, or prove that an external crawler can access it. Use a stable production URL rather than a temporary preview address, and make sure authentication, robots rules, or hotlink protection do not block the services that create social cards. The type field becomes the og:type value. Common choices include website for a general page and article for editorial content, while specialized vocabularies may use values such as profile or product. The generator accepts a non-empty type instead of restricting it to a short built-in list, allowing valid namespaced or application-specific values. Choose the value that matches the represented object and the Open Graph extensions used by your integration.
Install the tags and inspect the published result
The response includes an html field containing four newline-separated meta elements and a tags array containing the same elements individually. Insert them inside the document head, preferably through the route metadata system, server template, or static build step that owns the page. The order is stable: title, description, image, then type. Ampersands, angle brackets, quotation marks, and apostrophes are escaped in attribute values so supplied text cannot break the generated markup. Do not escape the returned markup again when placing it in an HTML template, or visitors and crawlers may receive visible entity text instead of functional tags. After deployment, inspect the delivered page source and confirm there is only one authoritative value for each property. Themes, plugins, and framework defaults sometimes add competing Open Graph elements. Finally, use the sharing debugger offered by the platforms important to your audience. Those tools can reveal inaccessible images and cached previews that markup generation alone cannot detect. A valid tag set gives crawlers clear input, but each platform still controls its final crop, truncation, cache, and presentation.
What you can do with it
Publish an article
Turn approved headline, summary, hero image, and article type values into a ready-to-insert social metadata block.
Build product pages
Generate consistent Open Graph markup from structured product records during a static or server-rendered build.
Standardize CMS output
Give editors a deterministic formatter that validates image protocols and safely escapes every supplied value.
FAQ
Which tags are generated?
The result contains og:title, og:description, og:image, and og:type meta elements.
Why was my image URL rejected?
The image must be a valid absolute URL whose scheme is http or https. Relative paths and other schemes are rejected.
Does the generator check whether the image exists?
No. It performs no network request, so it validates the URL format and protocol but not availability, dimensions, or crawler access.
Can I use an Open Graph type other than website or article?
Yes. Any non-empty type up to the declared limit is accepted, including values used by compatible Open Graph extensions.
What does the API cost?
The API costs $0.002 per request. The browser version is available free on this page.
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/web/open-graph-generate \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"title":"A Practical Guide to Urban Gardening","description":"Learn how to grow herbs and vegetables in a small city space.","image_url":"https://example.com/images/urban-garden.jpg","type":"article"}'const res = await fetch("https://api.kit.forhosting.com/web/open-graph-generate", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"title": "A Practical Guide to Urban Gardening",
"description": "Learn how to grow herbs and vegetables in a small city space.",
"image_url": "https://example.com/images/urban-garden.jpg",
"type": "article"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/web/open-graph-generate",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"title": "A Practical Guide to Urban Gardening",
"description": "Learn how to grow herbs and vegetables in a small city space.",
"image_url": "https://example.com/images/urban-garden.jpg",
"type": "article"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/web/open-graph-generate", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"title":"A Practical Guide to Urban Gardening","description":"Learn how to grow herbs and vegetables in a small city space.","image_url":"https://example.com/images/urban-garden.jpg","type":"article"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"title":"A Practical Guide to Urban Gardening","description":"Learn how to grow herbs and vegetables in a small city space.","image_url":"https://example.com/images/urban-garden.jpg","type":"article"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/web/open-graph-generate", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"title": "A Practical Guide to Urban Gardening",
"description": "Learn how to grow herbs and vegetables in a small city space.",
"image_url": "https://example.com/images/urban-garden.jpg",
"type": "article"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "web.open_graph_generate",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
timeout_sec | 30 |
max_crawl_pages | 25 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |