This page describes the simple scripting language implemented in MusicBrainz Picard.


The syntax is derived from Foobar2000's titleformat. There are three base elements: text, variable and function. Variables consist of alpha-numeric characters enclosed in percent signs (e.g. %artist%). Functions start with a dollar sign and end with an argument list enclosed in parentheses (e.g. $lower(...)).

To use parenthesis or commas as-is inside a function call you must escape them with a backslash.

Metadata Variables

See Picard tags for list of usable variables.

Technical Variables


  • Extension of the file name.
  • For example mp3 for file 01 Track.mp3.



  • If ifis not empty, it returns then, otherwise it returns else.


  • Returns first non empty argument.


  • Returns textin lower case.


  • Returns textin upper case.


  • Returns first numcharacters from text.


  • Returns the number of matched tracks within a release.
  • Added in version 0.12


  • Returns last numcharacters from text.


  • Returns numformatted to lendigits.


  • Replaces occurrences of searchin textwith value of replaceand returns the resulting string.




  • Returns true, if xcontains y.


  • Returns true, if multi-value variable xcontains y.
  • Since Picard 1.0


  • Unsets the variable name.

$set(name, value)

  • Sets the variable nameto value.
  • Note: To create a variable which can be used for the file naming string, but which will not be written as a tag in the file, prefix the variable name with an underscore. %something% will create a "something" tag; %_something% will not.

$setmulti(name, value, separator="; ")

  • Sets the variable nameto value, using the separator (or "; " if not passed) to coerce the value back into a proper multi-valued tag. This can be used to operate on multi-valued tags as a string, and then set them back as proper multi-valued tags, e.g
  • $setmulti(genre,$lower(%genre%))
  • Since Picard 1.0


  • Returns the variable name(equivalent to %name%).


  • Copies metadata from variable oldto new. The difference between $set(new,%old%)is that $copy(new,old)copies multi-value variables without flattening them.
  • Since Picard 0.9


  • Merges metadata from variable oldinto new, removing duplicates and appending to the end, so retaining the original ordering. Like $copy, this will also copy multi-valued variables without flattening them.
  • Since Picard 1.0


  • Trims all leading and trailing whitespaces from text. The optional second parameter specifies the character to trim.


  • Add yto x.


  • Subtracts yfrom x.


  • Divides xby y.


  • Returns the remainder of xdivided by y.


  • Multiplies xby y.


  • Returns true, if either xor ynot empty.


  • Returns true, if both xand yare not empty.


  • Returns true, if xis empty.


  • Returns true, if xequals y.


  • Returns true, if xnot equals y.


  • Returns true, if xis lower than y.


  • Returns true, if xis lower than or equals y.


  • Returns true, if xis greater than y.


  • Returns true, if xis greater than or equals y.


  • Does nothing (useful for comments or disabling a block of code).


  • Returns the number of characters in text.

$performer(pattern="",join=", ")

  • Returns the performers where the performance type (e.g. "vocal") matches pattern, joined by join.
  • Since Picard 0.10


  • Returns the first character of text. If textis not an alphabetic character nonalphais returned instead.
  • Since Picard 0.12


  • Returns the first character of each word in text, if it is an alphabetic character.
  • Since Picard 0.12


  • Truncate textto length.
  • Since Picard 0.12


  • Like $truncate except that it will only return the complete words from textwhich fit within lengthcharacters.
  • Since Picard 0.12


  • Moves the specified prefixes from the beginning to the end of text. If no prefix is specified 'A' and 'The' are used by default.
  • $swapprefix(%albumartist%,A,An,The,Le)
  • Integrated since Picard 1.3, previously as a plugin since Picard 0.13


  • Deletes the specified prefixes from the beginning of text. If no prefix is specified 'A' and 'The' are used by default.
  • Since Picard 1.3

Tagger Script Examples


Tagger Script usually creates, modifies or deletes metadata variables.

Artist names

$if($search(%album%,(feat. conductor)), $set(artist,%orchestra%))
  • Stupid assumption that all classical albums have "feat. conductor" in the title, but it shows the idea. :)

Live tracks on live albums

$if($and($eq(%releasetype%,live),$not($in(%title%,\(live\)))),$set(title,%title% \(live\)))

Remove "feat." from track titles

$set(title,$rreplace(%title%,\\s\\\(feat. [^\)]+\\\),))

Convert triple-dot to ellipsis


This one is useful for people concerned about correct typography and also fixes one problem on Linux: if an album (assuming it's also a directory) is called something like "...for you!", it is considered hidden and therefore might be not accessible from some applications.

Remove "various artists" on compilations

By default, Picard marks various-artist compilations with an album artist called "Various Artists". Even if you don't have anything by Torsten Pröfrock, it still means that your player will sort your comps between Vangelis and VCR instead of down at the end, which you may not want.

This is easy to fix:

$if($and($eq(%compilation%,1), $eq(%albumartist%,Various Artists)), $unset(albumartist) $unset(albumartistsort))

Merge writers into both composer and lyricist tags

Supported from version 1.0

Suppose you want to add anyone involved in writing to both the composer and lyricist tags.


File Naming Examples

OptionsOptions...File naming

Disc number only on multi-disc releases

Use the following snippet to insert the disc number in the new path if the release contains more than 1 medium.

$if($gt(%totaldiscs%,1),Disc $num(%discnumber%,2))

Lower case filenames with underscores

$lower($replace(%albumartist%/%album%/$num(%tracknumber%,2) %title%, ,_))

(Year) only if available


Use a different naming pattern for NATs

$if($eq([non-album tracks],%album%),[non-album tracks]/%tracknumber%. %artist% - ,%artist% - $if(%date%, $left(%date%,4) )- %album%/%tracknumber%.)%title%


  • Non-Album Tracks: [non-album tracks]/Band Name - Track Name.ext
  • Tracks in releases: Band Name - year - Release Name/##. Track Name.ext

Organize by alphabetical folders excluding leading The

To keep music organized by initial letter of artist's name you must first set the directory where saved files are to be stored in Options --> Moving Files. Then under Options --> File Naming check Rename files when saving. This script will then move saved files to your Moving Files location using the following hierarchy:

  • A/Artist Name, The/Year - Album Name (type-status)/Album (type-status)-disc#-Track-Song Title

for Various Artists-Albums

  • Various Artist/Year - Album Name (type-status)/Album (type-status)-disc#-Track-Song Title

$left($if2(%albumartistsort%, %artistsort%),30)/
$if(%date%,$left(%date%,4)) - $left(%album%,40) \(%releasestatus%-%releasetype%\)/
$left(%album%,30) \(%releasestatus%-%releasetype%\)-$if($gt(%totaldiscs%,1),$if2(%media%,CD)%discnumber%-,)$num(%tracknumber%,2)-$left(%title%,30)

$upper($firstalphachar($if2(%albumartistsort%, %artistsort%),#))
/$left($if2(%albumartistsort%, %artistsort%),18)/
$if(%date%,$left(%date%,4)) - $left(%album%,40) \(%releasestatus%-%releasetype%\)/
$left(%album%,30) \(%releasestatus%-%releasetype%\)-$if($gt(%totaldiscs%,1),$if2(%media%,CD)%discnumber%-,)$num(%tracknumber%,2)-$left(%title%,30)