Getting Started

Here's a small guide to get you started with Citation.js.


On Node.js, install the package (citation-js) like this:

npm install citation-js

To install the CLI as a global command, do this:

npm install --global citation-js

Browser Releases

Browser releases are available here. These define require and add citation-js as a module.

<script src="path/to/citation.js" type="text/javascript"></script>
  const Cite = require('citation-js')

Alternatively, you can use services as or the pre-built bundle at (minified) (latest)

The examples use version 0.3.4; this can be replaced with other versions

Note that

  • all GitHub builds before version 0.4.0-0 don't work in IE
  • the builds don't transpile dependencies, so don't work in IE either


Read more on the CLI

An example on how to run the CLI:

$ citation-js -t Q30000000 -f html -s citation-apa

This prints a HTML document containing wd:Q30000000 formatted as an APA-styled bibliographic entry.


Read more on Cite

To use the Cite constructor, require() the module like this:

const Cite = require('citation-js')

For example, to get the bibliographical data of the Wikidata item wd:Q21972834, and then format it in HTML, English and APA:

let example = new Cite('Q21972834')

let output = example.format('bibliography', {
  format: 'html',
  template: 'apa',
  lang: 'en-US'


To test this code, go to RunKit.