Loading N-Triples Formatter...
Please wait a moment

How to Format N-Triples RDF Data - Step by Step Guide

Step 1

Input Your N-Triples Data

Start by adding your N-Triples data. Whether it's from a database export or a text file:

•
Paste directly: Copy your N-Triples and paste it in
•
Upload a file: Click "Upload" to pick a .nt or .txt file
•
Try the sample: Click "Sample" to see an example

Example: Unformatted N-Triples Input

Here's what messy, unformatted N-Triples look like (hard to read):

<http://example.org/person/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Person> .
<http://example.org/person/1> <http://schema.org/name> "Dr. Alice Johnson" .
<http://example.org/person/1> <http://schema.org/email> "alice@research.org" . <http://example.org/person/1> <http://schema.org/jobTitle> "Data Scientist" .
<http://example.org/person/2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Person> .
Step 2

Automatic Validation & Formatting

As soon as you add your N-Triples, the formatter (powered by N3.js) cleans it up automatically. Here's what happens:

•
Checks syntax: Reads the text in strict N-Triples mode and shows the line and column of the first error
•
Adds consistent spacing: Each triple on its own line, with one space between terms
•
Leaves your terms alone: IRIs, blank node labels, escapes, language tags, datatypes and comments stay exactly as you typed them, in the same order
•
Counts triples: Shows you how many triples are in your data

Example: The Same Triples, One per Line

The fourth triple gets its own line; nothing else changes:

<http://example.org/person/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Person> .
<http://example.org/person/1> <http://schema.org/name> "Dr. Alice Johnson" .
<http://example.org/person/1> <http://schema.org/email> "alice@research.org" .
<http://example.org/person/1> <http://schema.org/jobTitle> "Data Scientist" .
<http://example.org/person/2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Person> .
Step 3

Export Clean N-Triples

Take the tidied N-Triples with you:

•
Copy to clipboard: Quick copy for pasting anywhere
•
Download as .nt file: Save for import into Apache Jena or Virtuoso
•
Convert to other formats: Use our RDF Format Converter if you need Turtle or JSON-LD

Example: Using Formatted N-Triples

Your formatted N-Triples are ready for:

→
Triple Store Import: Load into Apache Jena, Virtuoso, GraphDB, or Amazon Neptune for SPARQL querying
→
Data Integration: Merge with DBpedia, Wikidata, or custom knowledge graphs
→
Streaming Pipelines: Convert to Jelly-RDF for high-performance RDF streaming applications

Frequently Asked Questions

What is N-Triples format?

N-Triples is the plainest way to write RDF: one triple per line, every IRI spelled out in full inside angle brackets, and a full stop at the end. There are no prefixes or shortcuts, which is why triple stores like it for bulk loads and why diffs of .nt files are easy to read.

Does the formatter validate syntax?

Yes. N3.js reads your text in strict N-Triples mode, and the first problem is shown with its line and column and the line itself. Common slips get a plain explanation: a missing full stop, an unclosed string, a relative IRI such as <thing>, a Turtle prefix like xsd:integer, or a fourth term on a line, which makes it N-Quads.

Does formatting change my data?

No. Only the whitespace between terms and the line breaks change. IRIs, blank node labels like _:person1, escapes such as \u00e9, language tags and datatypes are copied exactly as you wrote them, so "8901240544102066246"^^<http://www.w3.org/2001/XMLSchema#integer> keeps every digit. Comments stay too. Before showing the result, the page reads it back and checks it holds the same triples as your input.

Why did some of my triples move to new lines?

N-Triples allows one triple per line. N3.js will accept two on the same line, but stricter readers such as Python's rdflib reject the file, so the formatter gives each triple its own line and tells you how many it split.

Can I convert N-Triples to other formats?

Yes. The RDF Format Converter turns N-Triples into Turtle, JSON-LD, N-Quads or RDF/XML, and it also goes the other way if you have Turtle or JSON-LD that you want as N-Triples.

Is my data uploaded anywhere?

No. Your triples are parsed and formatted in your browser and aren't sent to our server. Nothing is kept either: a reload starts with an empty editor. For very large dumps (hundreds of megabytes), a command-line tool such as Apache Jena's riot will be quicker than a browser tab.

Related: the RDF Format Converter for other RDF formats and the RDF Validator for Turtle, N-Quads and TriG files.