MyMemory API: a free translation API you can use without signup
Contents
I was looking for a free translation API that I could call directly from the browser, and I found MyMemory. It works without signup and allows CORS, which means you can call it straight from client-side JavaScript on a static site.
What Is the MyMemory API?
MyMemory is a service that provides one of the world’s largest translation memory databases. It returns results by combining human-translated data with machine translation.
Main points:
- No signup required
- RESTful API
- CORS enabled, so it can be called directly from the browser
- Supports multiple languages
API Specification
Base endpoint
GET https://api.mymemory.translated.net/get
Parameters
| Parameter | Required | Description |
|---|---|---|
q | Yes | Text to translate, up to 500 bytes |
langpair | Yes | Language pair, for example `en |
de | No | Email address, used to relax rate limits |
mt | No | Whether to use machine translation, disabled with 0 |
Example request
https://api.mymemory.translated.net/get?q=Hello&langpair=en|ja
Example response
{
"responseData": {
"translatedText": "こんにちは",
"match": 1
},
"responseStatus": 200
}
Usage Limits
The MyMemory API has a daily character limit.
| Usage mode | Limit | How it is counted |
|---|---|---|
Anonymous, no de parameter | 5,000 characters per day | By IP address |
Email specified with de | 50,000 characters per day | By email address |
Anonymous usage
If you do not specify the de parameter, usage is tracked by the requester’s IP address. For personal use, that is usually enough.
Raising the limit with an email address
Just adding an email address in the de parameter increases the limit by 10x. There is no registration form or email verification required.
https://api.mymemory.translated.net/get?q=Hello&langpair=en|ja&de=your@email.com
Running it in a web app
If you call the API from a static site with client-side JavaScript, the limit is counted against each user’s IP address. In other words, each visitor effectively gets their own 5,000 characters per day.
If you hard-code an email address, all users share the same 50,000-character daily pool, so anonymous mode is often the more efficient choice.
JavaScript Examples
Basic translation function
async function translate(text, sourceLang, targetLang) {
const params = new URLSearchParams({
q: text,
langpair: `${sourceLang}|${targetLang}`
});
const response = await fetch(
`https://api.mymemory.translated.net/get?${params}`
);
const data = await response.json();
if (data.responseStatus === 200) {
return data.responseData.translatedText;
}
throw new Error(data.responseDetails || 'Translation failed');
}
// Example usage
const result = await translate('Hello, world!', 'en', 'ja');
console.log(result); // こんにちは、世界!
With error handling
async function translateWithFallback(text, sourceLang, targetLang) {
try {
const params = new URLSearchParams({
q: text.slice(0, 500), // 500-byte limit
langpair: `${sourceLang}|${targetLang}`
});
const response = await fetch(
`https://api.mymemory.translated.net/get?${params}`
);
if (!response.ok) {
throw new Error(`HTTP error: ${response.status}`);
}
const data = await response.json();
if (data.responseStatus !== 200) {
throw new Error(data.responseDetails || 'Translation failed');
}
return {
success: true,
text: data.responseData.translatedText,
match: data.responseData.match
};
} catch (error) {
return {
success: false,
error: error.message
};
}
}
Language Codes
Here are the main language codes.
| Language | Code |
|---|---|
| Japanese | ja |
| English | en |
| Chinese (Simplified) | zh-CN |
| Chinese (Traditional) | zh-TW |
| Korean | ko |
| French | fr |
| German | de |
| Spanish | es |
| Italian | it |
| Portuguese | pt |
| Russian | ru |
All language codes follow ISO 639-1.
Summary
MyMemory is a translation API that requires no signup, supports CORS, and can be used directly from a static site. Even the free tier is enough for personal use, and it is easy to integrate into a web app.
Compared with self-hosted options like LibreTranslate, the advantage is that you do not need to operate a server. The tradeoff is relying on an external service and staying within the 500-byte limit per request.
Try It Yourself
I also built a translation tool in the lab using this API. You can try it directly in the browser.