Question: I would like to use TikZ in other settings than TeX and I'd especially like to use the drawings on websites where the text should be searchable and selectable. However, I'm unsure of the best way to convert my drawings to SVG.

How do I best take some TikZ code, render the drawing and turn the output into SVG?

Answer: 
On linux, you can use [`pdf2svg`](http://www.cityinthesky.co.uk/opensource/pdf2svg) (an opensource tool). All glyphs are converted to paths, thus you can't edit your text. But it is the only tool that seems to give good results for images mixing drawings and texts.

In your MWE, to get smooth result, I add the `smooth` option to `plot`.

Here is a snapshot of the svg file rendered by Firefox (*click on the image to download the SVG file*):

[![enter image description here](https://i.stack.imgur.com/mGvGX.png)](http://perso.mines-albi.fr/~gaborit/latex/tikz-to-svg-test.svg)

Here the two commands used to convert TEX to SVG:

```
pdflatex file.tex
pdf2svg file.pdf file.svg
```

Your MWE with my changes:

```
\documentclass{standalone}
\usepackage{tikz}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\begin{document}
\begin{tikzpicture}[domain=-2:2,samples=100,scale=1.0,>=latex]
\tikzset{bgrid/.style={help lines,color=blue!10,very thin}}

\draw[bgrid] (-1.5,-3.5) grid (7.5,3.5);

\draw[<->, color=black] (-1.5,0) -- (7.5,0) node[right] {$x$};
\draw[<->, color=black] (0,-3.5) -- (0,3.5) node[above] {$y$};

\foreach \x/\xtext in {-1,1,2,3,4,5,6,7}
\draw (\x cm,1pt) -- (\x cm,-1pt) node[anchor=north] {$\xtext$};

\foreach \y/\ytext in {-3,-2,-1,1,2,3}
\draw (1pt,\y cm) -- (-1pt,\y cm) node[anchor=east] {$\ytext$};

\draw[thick,color=black,domain=0:7.5,smooth]
plot (\x,{sqrt(\x)}) node[anchor=south] {$y = \sqrt{x}$};
\draw[dashed,color=black,domain=0:7.5,smooth]
plot (\x,{(-1)*(sqrt(\x))}) node[anchor=north] {$y = -\sqrt{x}$};
\draw[thick,color=black,domain=-1.5:5.5,samples=3]
plot (\x,{(\x)-2}) node[anchor=south] {$y = x - 2$};

\filldraw[black] (4,2) circle(2pt) node[anchor=south east] {$(4, 2)$};
\filldraw[red] (1,-1) circle(2pt);
\draw[red] (1.5,-1) node[anchor=west] {$(1, -1)$};

\end{tikzpicture}
\end{document}

```
I've written a command line utility that automates the process described in the [accepted answer](https://tex.stackexchange.com/a/51766/163851).

It's called *tikztosvg* and it is distributed under the GPL-3 license at [it's official GitHub repository](https://github.com/GarkGarcia/tikztosvg). Let's say you want to convert the file `example.tikz` to SVG:

```latex
\begin{tikzcd}
    G \arrow[r, "\varphi"] \arrow[d, "\psi"', two heads] & H \\
    \sfrac{G}{\ker \varphi} \arrow[ru, dotted]           &
\end{tikzcd}

```

You could achieve that by running the following command:

```
$ tikztosvg -p tikz-cd -p xfrac example.tikz

```

The results will be stored in the file `example.svg`:

![example](https://raw.githubusercontent.com/GarkGarcia/tikzin/master/example/example.svg?sanitize=true)

I'd love to have some feedback on it. Issues and PRs are very much welcomed!