What is the RPY file format?
.rpy is a script file used by the Ren'Py visual-novel engine. While the format's extension echoes its .py roots, an .rpy file is not a plain Python source: it is written in Ren'Py's own domain-specific language, which layers high-level storytelling statements - character dialogue, scene directives, branching menus, and conditional story flow - on top of Python's familiar syntax rules. .rpy files can contain code written in Python directly alongside Ren'Py-specific statements.
.rpy is a plain text file encoded in UTF-8 and can be opened and edited in any text editor. Authors editing .rpy scripts must take care with indentation, as Ren'Py uses indentation to define code blocks, just as Python does. For advanced logic, scripts can embed raw Python inside python: blocks or via the $ single-line prefix, giving authors access to Python's full standard library within a Ren'Py project.
When Ren'Py launches a game it compiles each .rpy source file into a binary .rpyc cache file for faster loading. Distributed games typically ship only the compiled .rpyc files, often packed inside an .rpa archive, so players do not normally see the .rpy source. Community tools such as unrpyc can decompile .rpyc files back to readable .rpy scripts.
A typical project splits its story and logic across many .rpy files - one might define characters and variables, another manage menu screens, another hold the main narrative. The Ren'Py SDK treats all .rpy files in a project directory as a single program, compiling and linking them together at startup.
Security & safety
RISK: MEDIUMA .rpy is plain text and safe to open in an editor, but it is executable logic for the Ren'Py engine and can contain full Python inside python: blocks - so running an untrusted Ren'Py game/mod can execute arbitrary code on your machine. Read scripts from unknown mods before adding them to a game, and obtain games/mods from reputable sources. Editing the dialogue text itself is harmless; pasting in unknown python: blocks is not.
Format details
in a nutshell- Twisted Resource (Python web script) - Legacy .rpy used by the Twisted/twistd web server as a Python script that returns a resource object - unrelated to Ren'Py.
- RPGMaker / misc generic Python script - Some tools historically labelled any saved Python source as .rpy; today the Ren'Py meaning dominates.
Programs that open RPY files
Technical details
deep spec| File category | Plain-text source script - Ren'Py's domain-specific language for visual novels |
| Encoding | UTF-8 plain text; no binary magic bytes or byte-order mark required |
| MIME type | text/plain (also recognized as text/x-python by generic tooling) |
| Compiled form | Each .rpy is compiled to a binary .rpyc file by the Ren'Py engine at startup |
| Indentation rule | Python-style significant whitespace indentation defines all code blocks |
| Core statement types | label, jump, call, menu, scene, show, hide, play, define, init |
| Embedded Python | Full Python code accessible via python: blocks and the $ single-line statement prefix |
| Python version | Ren'Py 6 and 7 use Python 2 syntax; Ren'Py 8 and later require Python 3 syntax |
| Typical file size | 1 KB to ~500 KB; a full game project spans multiple .rpy files |
| Distribution method | Games ship compiled .rpyc files packed in .rpa archives - not the .rpy source |
| Platform support | Authored on Windows, macOS, Linux; games build and run on Android and iOS as well |
| Project compilation | All .rpy files in the game directory are compiled and linked as a single program at launch |
| Syntax error reporting | Ren'Py SDK surfaces syntax and logic errors at launch with file name and line number |
| Decompilation | The community tool unrpyc can reconstruct .rpy source from compiled .rpyc bytecode |
| Character support | Full Unicode via UTF-8 for multilingual dialogue text and identifier names |
| Released | Ren'Py engine, first release 2004 |
| Latest version | Ren'Py 8.x (Python 3 based); script syntax tracks the engine release |
| Open standard | Yes · royalty-free |
| Specification | www.renpy.org |
RPY conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about RPY files.