What is the RDS file format?
An .rds file is an R Data Serialization file produced by R's saveRDS() function. It stores exactly one R object - a data frame, list, model, vector, or any other R structure - in R's native binary serialization format. Unlike .RData files created by save(), which restore named objects directly into the global environment, .rds files are loaded with readRDS() and returned as a value that the caller can assign to any variable name.
By default, the serialized data is wrapped in gzip compression, so most .rds files open as gzip streams if not handled as R objects (magic bytes 1F 8B). Compression can also be set to bzip2, xz, or disabled entirely with saveRDS(obj, file, compress = FALSE).
R supports two serialization format versions: version 2 (R 1.4-3.4, default before R 3.5.0) and version 3 (default since R 3.5.0, released April 2018), which adds explicit encoding metadata for character strings - important for non-ASCII text. File sizes range from a few kilobytes for small vectors to several gigabytes for large data frames or complex models.
.rds files are the standard unit of R object persistence: analysts use them to cache intermediate results, share trained model objects, and store processed data between sessions. For interoperable columnar data shared across tools, formats such as .parquet are increasingly preferred; .rds remains the go-to choice whenever the consumer is always R.
Security & safety
RISK: MEDIUMRDS files can embed arbitrary R code via closures, S4 methods, or R5/R6 class environments. readRDS() evaluates promises and active bindings on access. Do not open .rds files from untrusted sources in R, as maliciously crafted objects could execute code during deserialization. The R Core Team has noted this risk in the documentation.
Format details
in a nutshell- Ray Dream Studio Scene File - Legacy 1990s 3D animation format by Ray Dream Inc. / MetaCreations (later Carrara/DAZ); binary with magic 'RD ' (0x33 0x44 0x43 0x20 in hex '3DC '); software is abandoned, files unreadable by modern tools.
Programs that open RDS files
Technical details
deep spec| Encoding | Binary (gzip-compressed by default); bzip2, xz, or uncompressed variants also supported |
| Objects stored | Exactly one R object per file - any SEXP type: vector, list, data.frame, model, environment reference, etc. |
| Serialization format version | Version 2 (R 1.4-3.4) or version 3 (R 3.5+, default since 2018); version number stored in stream header |
| Default compression | gzip (compress=TRUE); alternatives: bzip2, xz, or none (compress=FALSE) |
| Magic bytes | 1F 8B (gzip header, compressed); 58 0A (XDR uncompressed); 41 0A (ASCII uncompressed) |
| Byte order | Big-endian XDR (External Data Representation) for the raw serialization stream; compression wrapper is platform-independent |
| Serialization scope | Single R object (contrast with .RData which stores one or more named objects restored into the calling environment) |
| Character encoding metadata | Version 3 format embeds explicit encoding metadata for character strings, enabling correct handling of non-ASCII content |
| Typical file size | A few KB (small vectors) to several GB (large data frames, trained machine-learning models) |
| Read/write functions | readRDS() returns the object as a value; saveRDS() writes it - caller assigns any variable name on load |
| Platform compatibility | Cross-platform; Windows, Linux, and macOS produce identical serialization streams |
| Compression verification | Inspect magic bytes with a hex editor; or use R's gzcon() / file() connection functions to confirm gzip wrapping |
| Released | 2001 (R 1.4.0, saveRDS/readRDS introduced) |
| Latest version | Serialization format version 3 (R 3.5.0, 2018) |
| Open standard | Yes · royalty-free |
| Specification | stat.ethz.ch |
RDS conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about RDS files.