Skip to main content
When you create a base in Obsidian, it is saved as a .base file. Bases are typically edited through the app interface, but you can also edit the underlying syntax directly or write it in a base code block embedded in a Markdown note. Bases syntax is YAML-based. Filters and formulas share the same expression language.

Complete example

Here is a fully configured .base file:
filters:
  or:
    - file.hasTag("tag")
    - and:
        - file.hasTag("book")
        - file.hasLink("Textbook")
    - not:
        - file.hasTag("book")
        - file.inFolder("Required Reading")
formulas:
  formatted_price: 'if(price, price.toFixed(2) + " dollars")'
  ppu: "(price / age).toFixed(2)"
properties:
  status:
    displayName: Status
  formula.formatted_price:
    displayName: "Price"
  file.ext:
    displayName: Extension
summaries:
  customAverage: 'values.mean().round(3)'
views:
  - type: table
    name: "My table"
    limit: 10
    groupBy:
      property: note.age
      direction: DESC
    filters:
      and:
        - 'status != "done"'
        - or:
            - "formula.ppu > 5"
            - "price > 2.1"
    order:
      - file.name
      - file.ext
      - note.age
      - formula.ppu
      - formula.formatted_price
    summaries:
      formula.ppu: Average

Sections

filters

The filters section narrows which files the base includes. Without filters, a base shows every file in your vault. Filters can be applied at two levels:
  1. Global — under the top-level filters key. Applies to all views.
  2. Per-view — inside an individual view’s filters key. Applies only to that view.
Both levels are combined with AND when evaluating a view.
# Simple filter
filters:
  and:
    - file.hasTag("tag")

# Complex filter with nested logic
filters:
  or:
    - file.hasTag("tag")
    - and:
        - file.hasTag("book")
        - file.hasLink("Textbook")
    - not:
        - file.hasTag("book")
        - file.inFolder("Required Reading")
A filter statement is any expression that evaluates to truthy or falsey for a given file. This includes comparisons and function calls.

formulas

The formulas section defines computed properties available across all views:
formulas:
  formatted_price: 'if(price, price.toFixed(2) + " dollars")'
  ppu: "(price / age).toFixed(2)"
Formulas are stored as strings in YAML. Use nested quotes for text literals. A formula’s output type is determined by the data and functions used — formulas are not constrained to strings at runtime. Reference property types in formulas:
TypeSyntaxExample
Note propertyproperty or note.propertyprice
File propertyfile.name, file.sizefile.mtime
Another formulaformula.nameformula.ppu

properties

The properties section stores display configuration for properties:
properties:
  status:
    displayName: Status
  formula.formatted_price:
    displayName: "Price"
  file.ext:
    displayName: Extension
Display names are used in column headers and UI labels. They are not used in filters or formulas.

summaries

The summaries section defines custom summary formulas. In the values expression, values is a list of all values for that property across every row in the result set:
summaries:
  customAverage: 'values.mean().round(3)'
Default summary formulas are also available without defining them here:
NameInput typeDescription
AverageNumberMean of all values
MinNumberSmallest value
MaxNumberLargest value
SumNumberTotal of all values
RangeNumberDifference between max and min
MedianNumberMedian value
StddevNumberStandard deviation
EarliestDateOldest date
LatestDateMost recent date
RangeDateDifference between earliest and latest
CheckedBooleanCount of true values
UncheckedBooleanCount of false values
EmptyAnyCount of empty values
FilledAnyCount of non-empty values
UniqueAnyCount of distinct values

views

The views section is a list of view configurations:
views:
  - type: table
    name: "My table"
    limit: 10
    groupBy:
      property: note.age
      direction: DESC
    filters:
      and:
        - 'status != "done"'
    order:
      - file.name
      - note.age
    summaries:
      formula.ppu: Average
KeyDescription
typeLayout type: table, list, cards, map
nameDisplay name for the view. Used to select a default view when embedding.
limitMaximum number of rows to display.
filtersView-specific filters (same syntax as global filters).
groupByProperty and direction to group results.
orderList of property names defining column order.
summariesMap of property names to summary formula names.

Properties in bases

Bases work with three types of properties:

Note properties

Stored in the YAML frontmatter of Markdown files. Access with property_name or note.property_name:
author == "Ursula Le Guin"
note.status == "Done"

File properties

Built-in properties available for all file types:
PropertyTypeDescription
file.nameStringFile name including extension
file.basenameStringFile name without extension
file.pathStringFull path relative to vault root
file.folderStringPath to the parent folder
file.extStringFile extension
file.sizeNumberFile size in bytes
file.tagsListTags including inline tags
file.linksListInternal links within the file
file.ctimeDateCreation timestamp
file.mtimeDateLast-modified timestamp
file.propertiesObjectAll frontmatter properties

this — context-aware file reference

Use this to reference the file where the base is displayed:
  • Opened as a file: this refers to the .base file itself.
  • Embedded in a note: this refers to the embedding note.
  • In a sidebar: this refers to the active file in the main content area.
Example — replicate the backlinks panel:
filters:
  and:
    - file.hasLink(this.file)

Operators

Arithmetic

OperatorDescription
+Add
-Subtract
*Multiply
/Divide
%Modulo
( )Parentheses (grouping)

Comparison

OperatorDescription
==Equals
!=Not equal
>Greater than
<Less than
>=Greater than or equal to
<=Less than or equal to

Boolean

OperatorDescription
!Logical not
&&Logical and
||Logical or

Date arithmetic

Add or subtract durations from dates using string suffixes:
now() + "1 day"
file.mtime > now() - "1 week"
date("2024-12-01") + "1M" + "4h" + "3m"
UnitAccepted formats
Yeary, year, years
MonthM, month, months
Dayd, day, days
Weekw, week, weeks
Hourh, hour, hours
Minutem, minute, minutes
Seconds, second, seconds
Subtracting two dates returns the difference in milliseconds.

Types

TypeNotes
StringEnclosed in single or double quotes: "hello", 'world'
NumberWritten as digits, optionally in parentheses: 1, (2.5)
Booleantrue or false (no quotes)
DateCreated with date(), today(), or now()
ListAccess elements with property[0] (0-based index)
ObjectAccess values with property.key or property["key"]
LinkWikilinks in frontmatter are automatically recognized; construct with link("path")

Build docs developers (and LLMs) love