TL;DR
RandomDog is the simplest dog image API on the internet. Call the endpoint and you get a random dog photo — no API keys, no complex parameters, no account creation. It's perfect for quick prototyping, fun side projects, or adding a random dog button to any app. The API returns image URLs (JSON mode) or redirects directly to the image.
Quick start: https://random.dog/woof.json
No API key needed — just make a request!
How to Use This API
1. Random Dog (JSON with Image URL)
https://random.dog/woof.json
Returns a JSON object: {"url":"https://random.dog/abc123.jpg","mediaType":"image/jpeg"}
2. Direct Image
https://random.dog/woof
Returns the raw image data directly — ideal for use in an <img> src attribute.
3. Filter by Media Type
https://random.dog/woof.json?filter=mp4
Filter results: mp4 (video), jpg, png, gif. The API will return a random file matching your filter.
4. JavaScript — Random Dog Button
async function getRandomDog() {
const resp = await fetch('https://random.dog/woof.json');
const data = await resp.json();
return data.url;
}
async function displayDog() {
const img = document.getElementById('dog-image');
if (img) {
img.src = await getRandomDog();
img.alt = 'Random dog';
img.style = 'max-width:500px;border-radius:10px;';
}
}
// HTML button: <button onclick="displayDog()">New Dog!</button>
// HTML img: <img id="dog-image" src="" alt="Random dog">
5. Python — Fetch & Save
import requests
def save_random_dog(filename='dog.jpg', filter_type=None):
params = {}
if filter_type:
params['filter'] = filter_type
resp = requests.get(
'https://random.dog/woof.json',
params=params
)
data = resp.json()
img_url = data['url']
img_resp = requests.get(img_url)
with open(filename, 'wb') as f:
f.write(img_resp.content)
print(f'Saved: {img_url} -> {filename}')
save_random_dog('doggie.jpg', 'jpg')
https://random.dog/woof.json
Frequently Asked Questions
- What types of media are available?
- JPEG images, PNG images, GIF animations, and MP4 videos. Filter with
?filter=mp4,?filter=jpg,?filter=gif, or?filter=png. - How is RandomDog different from Dog CEO?
- Dog CEO organizes images by breed. RandomDog is truly random — any breed, any format — with no breed filtering. It's simpler and great for "just show me a dog" use cases.
- Are there rate limits?
- The API is free with no documented rate limits. It's been running reliably for years as a community service.
- Can I embed the direct image URL?
- Yes! The URL from
woof.jsoncan be used directly in<img>tags. Or use the image endpoint at/woofwhich redirects to a random image. - Do I need to handle different aspect ratios?
- Yes, the images come in all shapes and sizes. Use CSS
object-fit: coverfor consistent container sizing.
API Details
- API URL
https://random.dog- Documentation
- random.dog
- Category
- Animals
- Authentication
- Not Required
- Geographic Coverage
- Global
What You Can Build
- "Random dog of the day" widget for websites
- Stress relief app that shows a new dog on every click
- Dog image slideshow for pet adoption pages
- Background image rotator for desktop/mobile apps
- Fun loading screen images during app bootstrap