WebP Conversion API Documentation

Simple, free API for converting WebP images to JPG or PNG

100 Free Conversions/DayNo API Key Required

Quick Start

Using cURL

curl -X POST \
  -F "file=@image.webp" \
  https://webp2jpg.co/api/convert?format=jpg \
  -o output.jpg

Using JavaScript/Node.js

const formData = new FormData();
formData.append('file', fileInput.files[0]);

const response = await fetch('https://webp2jpg.co/api/convert?format=jpg', {
  method: 'POST',
  body: formData
});

const blob = await response.blob();
const url = URL.createObjectURL(blob);
// Use the converted image

Using Python

import requests

with open('image.webp', 'rb') as f:
    files = {'file': f}
    response = requests.post(
        'https://webp2jpg.co/api/convert?format=jpg',
        files=files
    )

with open('output.jpg', 'wb') as f:
    f.write(response.content)

API Reference

POST/api/convert

Convert a WebP image to JPG or PNG format.

Request Parameters

ParameterTypeRequiredDescription
filemultipart/form-dataYesWebP image file (max 10MB)
formatquery stringNoOutput format: jpg or png (default: jpg)
qualityquery stringNoQuality 1-100 (default: 90)

Response

Success (200):

  • Returns converted image file as binary data
  • Content-Type: image/jpeg or image/png
  • Content-Disposition header includes suggested filename

Response Headers

HeaderDescription
X-Rate-Limit-RemainingRemaining conversions today
X-Rate-Limit-LimitTotal daily limit (100)

Error Responses

429 Too Many Requests

{
  "error": "Rate limit exceeded",
  "message": "Free tier allows 100 conversions per day",
  "limit": 100
}

400 Bad Request

{
  "error": "No file provided"
}

413 Payload Too Large

{
  "error": "File too large",
  "message": "Maximum file size is 10MB",
  "maxSize": 10485760
}

Rate Limits

Free Tier

  • 100 conversions per day
  • No API key required
  • Max 10MB per file
  • Rate limited by IP

Need More?

For higher volume needs, consider running your own instance or using our web interface.

Try Web Converter

Integration Examples

React Component

function WebPConverter() {
  const [converting, setConverting] = useState(false);

  const handleConvert = async (file) => {
    setConverting(true);

    const formData = new FormData();
    formData.append('file', file);

    const response = await fetch(
      'https://webp2jpg.co/api/convert?format=jpg',
      { method: 'POST', body: formData }
    );

    const blob = await response.blob();
    const url = URL.createObjectURL(blob);

    // Download or display converted image
    const a = document.createElement('a');
    a.href = url;
    a.download = 'converted.jpg';
    a.click();

    setConverting(false);
  };

  return (
    <input
      type="file"
      accept=".webp"
      onChange={(e) => handleConvert(e.target.files[0])}
      disabled={converting}
    />
  );
}

PHP

<?php
$file = $_FILES['image'];
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://webp2jpg.co/api/convert?format=jpg');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
    'file' => new CURLFile($file['tmp_name'], $file['type'], $file['name'])
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$result = curl_exec($ch);
curl_close($ch);

header('Content-Type: image/jpeg');
echo $result;
?>

Best Practices

  • Check rate limit headers

    Monitor X-Rate-Limit-Remaining to avoid hitting limits

  • Validate file types

    Check file extension before uploading to save quota

  • Handle errors gracefully

    Implement retry logic with exponential backoff

  • Compress before uploading

    Stay under 10MB limit by resizing large images