N-Triples
Convert any formatto N-Triples Convert from N-Triplesto any other format
N-Triples (extension .nt, media type application/n-triples) is a line-based, plain-text serialization for RDF graphs, standardized by the W3C RDF Working Group as a Recommendation on 25 February 2014 as part of RDF 1.1. It originated in work by Dave Beckett (University of Bristol) and Art Barstow (W3C), designed to be a deliberately simpler format than Notation3 (N3) and Turtle so that software could parse and generate it with minimal machinery. It was first used to express the canonical "model answers" of the RDF test suite before becoming a widely used interchange format in its own right.
The data model is exactly RDF: each line encodes one triple as subject, predicate, and object separated by whitespace and terminated by a period and newline. Subjects are IRIs or blank nodes; predicates are always IRIs; objects may be IRIs, blank nodes, or literals. IRIs are written in full inside angle brackets (e.g. <http://example.org/thing>), blank nodes as _:label, and literals as double-quoted strings optionally carrying a @lang language tag or a ^^<datatype-IRI> typed-value suffix (a bare literal defaults to xsd:string). The document is a UTF-8 Unicode string, and non-ASCII characters may also be written with \u/\U numeric escapes.
N-Triples is formally a subset of Turtle: it drops all of Turtle's abbreviation machinery — no @prefix/CURIE shortcuts, no base IRI, no ;/, object grouping, no a keyword — so every triple is fully self-contained. Parsing the same triples from N-Triples and Turtle yields identical graphs. The named-graph extension N-Quads adds an optional fourth term (a graph label) per line, and the RDF-star family layers quoted-triple syntax on the same base.
That verbosity is the deliberate trade-off. Because each line is independent and context-free, N-Triples excels at streaming, line-oriented Unix-tool processing (sort, grep, split), diffing, incremental loading of very large dumps, and canonicalization/hashing for graph comparison. The same lack of shortcuts makes it bulky and tedious to author or read by hand, and the repeated full IRIs inflate file size relative to Turtle, RDF/XML, or JSON-LD. Tooling is broad: libraries such as RDFLib (Python), Jena/RIOT, dotNetRDF, and EasyRdf Converter read and write it, and converters like rdf2rdf and RDF Grapher move between it and other RDF serializations.
Alternative Names: NTriples, NT
| Feature | N-Triples |
|---|---|
| Multiple Graphs per Document | |
| Nodes | |
| Undirected Edges | |
| Directed Edges | |
| Hyperedges | |
| Mixed-directionality Edges | |
| Parallel Edges | |
| Self-loops | |
| Edges on Edges | |
| Nested Graphs in Nodes | |
| Nested Graphs in Edges | |
| Nested Graphs in Graphs | |
| Node Labels | |
| Edge Labels | |
| Attributes on Nodes | |
| Attributes on Edges | |
| Attributes on Graphs | |
| Typed Edges | |
Tools(Read & Write)
Read-only Tools
Frequently Asked Questions
What is a N-Triples file?
A N-Triples file stores a graph — its nodes, edges and attributes — in the N-Triples format (also: NTriples, NT). See the feature table above for what it supports.
How do I open a N-Triples file?
Open it in a graph tool that supports N-Triples, or convert it to a format your tool reads. With GraphInOut you can convert N-Triples to GraphML, DOT, Connected JSON and more, right in your browser.
How do I convert a N-Triples file to another format?
Use the Convert from N-Triples link above: upload or paste your N-Triples file (input preset to N-Triples), choose a target format and download the result — free, no install.
