gTTS
gTTS (Google Text-to-Speech), a Python library and CLI tool to interface with Google Translate text-to-speech API
What it is and what it does
gTTS is a Python wrapper around Google Translate's undocumented text-to-speech functionality. It lets you generate MP3 audio from text strings and save them to disk, pass them to other audio libraries, or stream to stdout. The library includes a customizable sentence tokenizer to handle long texts while preserving intonation, abbreviations, and decimals, and supports custom text pre-processors for pronunciation corrections.
You can use it as a Python module or via a command-line tool (gtts-cli). It supports modern Python versions (3.8–3.12) across macOS, Windows, and Linux. The project is not affiliated with Google and relies on an undocumented API, so breaking changes can occur without notice—it is explicitly different from the official Google Cloud Text-to-Speech service.
Use it for:
- Generate spoken audio files from text for accessibility or content creation workflows.
- Build a command-line tool to batch-convert text documents or scripts into MP3 files.
- Integrate text-to-speech into a Python application without setting up a paid cloud service.
- Preprocess and customize pronunciation in generated speech using text pre-processors.
- Stream audio output directly to stdout for piping into other audio processing tools.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
gTTS converts text to speech using Google Translate's API, writing MP3 audio to files, file-like objects, or stdout via Python library or command-line tool.
Yes, if you need lightweight, free text-to-speech without cloud setup. The low install friction, active maintenance, and MIT license make it straightforward to adopt. However, be aware that it depends on Google Translate's undocumented API—upstream changes can break it without notice, and it is not a substitute for official Google Cloud Text-to-Speech if you need production-grade reliability or SLA guarantees.
Install
gtts on PyPI
pip
pip install gttsuv
uv add gttspoetry
poetry add gttsInstalling gTTS
Before you install
Low install friction with only two runtime dependencies (requests, click). Actively maintained with recent commits and a large user base; last release was 642 days ago but repo shows ongoing activity.
License in practice
MIT license is permissive, allowing commercial and private use with minimal restrictions—suitable for most projects.
Quickstart
pip install gTTS
from gtts import gTTS
tts = gTTS('hello')
tts.save('hello.mp3')
Requires internet access to reach Google Translate's API; relies on that undocumented endpoint remaining available.
Verify before relying
- Whether Google Translate API changes could break the package without notice, as the description disclaims.
- Performance characteristics when handling very long texts or batch conversions.
- Audio quality or language support coverage compared to official Google Cloud Text-to-Speech.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — requests, click |
| Maintenance | actively maintained — 642 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,340,702/month — #2,115 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: gTTS-2.5.4-py3-none-any.whl
Keywords: gtts, text to speech, Google Translate, TTS
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
pyttsx3pyttsx3 converts text to speech offline using…
copyleft · top 5,000 on PyPI
edge-ttsConverts text to speech using Microsoft Edge's…
copyleft · top 5,000 on PyPI
piper-ttsPiper TTS is a local neural text-to-speech…
copyleft · top 5,000 on PyPI
chatterbox-ttsChatterbox TTS converts text to speech using…
permissive · top 15,000 on PyPI
google-cloud-texttospeechProvides a Python client to Google Cloud…
permissive · top 1,000 on PyPI
pocket-ttsPocket TTS generates speech from text on CPU…
unclear · top 15,000 on PyPI
TTSTTS is a deep learning library for…
copyleft · top 15,000 on PyPI
livekit-plugins-sonioxIntegrates Soniox speech-to-text and…
permissive · top 15,000 on PyPI
mlx-audioMLX-Audio provides text-to-speech,…
permissive · top 15,000 on PyPI
eyeD3eyeD3 reads, edits, and displays ID3 metadata…
copyleft · top 15,000 on PyPI